Showing results for 
Search instead for 
Did you mean: 
New Member

addDays expression (Thursday - Sunday)

Hi all,

I would like to do a small customizing of a Flow that I have.

Email with high priority > Create a to-do item in Microsoft To-Do


It will create a To-Do item with a reminder 2 days later.


Expression that I simply copied from a forum:

addDays(utcnow(), 2, 'yyyy-MM-dd')
Now, here is the tricky part (for me, since I am not a coder).
1. I want emails that I get from Thursday - Sunday to be set to as the reminder date as Tuesday the following week.
So emails that I get from Monday - Wednesday does not need to be changed, anything in this range should not be affected.
Only emails from Thursday - Sunday.
2. I want it to set as a reminder 1 PM, now the time is set in swedish time to 1 AM which is obviously not a good time.
3. I want to change the time to swedish time. (UTC +01.00)
I believe a lot of people could have use for this kind of reminder so I am really hoping that someone can help me out and I could submit it to Microsoft or if someone else does I dont really care. Lets make it happen.
Community Support
Community Support

Hi @abbe83,


About #1, please consider using workflow definition language function dayofweek to return the day of week component of a string timestamp. Sunday is 0, Monday is 1, and so on.

I assume that your flow should be triggered by “Office 365 Outlook – when new email arrives”, you could use the dynamic content “Received time” from the trigger.

Add a Compose action to return the day of week component of the received time.

The function could be configured likes:


After the Compose action, you could try to use Switch cases. As we know that Thursday is 4, Friday is 5, and so on. So you can add cases likes below to create a to-do task according to the return value.


In the action “Add a to-do”, add days according to the return value so that you can create a reminder date as Tuesday the following week.

Say if the received date is Thursday, the function for the reminder date is:


The flow could be configured to something likes below:


Reference materials:
Workflow definition language
Switch case

About #2 and #3, you may consider using the action “Convert time zone” in your flow.


Please check this blog for more details:

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ok all setup now, ignored the time thing for now as that would be complex. Will test and get back.

Once again thanks for the help.

So the emails are getting through to my todo but the reminder date is not being set.


So I am wondering what I am doing wrong.

I have created switch cases. See images for understanding, sorry its in Swedish though.


1. I have the email, sends when high Priority, nothing else set. This part works.

2. Then see the image below, the Input (Indata) is like you wrote this, exactly this



3. Below it is just the Ouput for the Switch cases.


4. I have a feeling that either entry in point 2 is incorrect but more likely is the input in the To-Do below

For example below we have for Sunday which you said is day 0.

The reminder date is formatted exactly like this



Because I want it to set it to Tuesday.

Have I set it incorrectly? How will the system understand that its this coming Tuesday?


I have used the same logic 


5. Here is how I set all of them

Case 0







Case 1







Case 2







Case 3







Case 4







Case 5







Case 6





Very grateful for help, I am missing something, but what?!

Not applicable

Hi @v-yamao-msft!


If I need to calculate a 'Due Date' that is 30 BUSINESS DAYS from today, could I utilize any of this logic?


So far, I know that the following formula gives me 30 days from today, but that includes weekends: 

formatDateTime(addDays(utcNow(), 15), 'yyyy-MM-dd').


Any ideas on how to calculate 30 business days from today would be greatly appreciated!!!

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,946)