web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / addDays expression (Th...
Power Automate
Unanswered

addDays expression (Thursday - Sunday)

(0) ShareShare
ReportReport
Posted on by 4

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.
Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    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:

    dayofweek(triggerBody()?['DateTimeReceived'])


    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:

    adddays(triggerBody()?['DateTimeReceived'],5,'yyyy-MM-dd')


    The flow could be configured to something likes below:
    3.PNG

     


    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:
    https://flow.microsoft.com/en-us/blog/working-with-dates-and-times/


    Best regards,
    Mabel Mao

  • Abraham Georges Profile Picture
    4 on at

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

  • Abraham Georges Profile Picture
    4 on at

    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

    dayofweek(triggerBody()?['DateTimeReceived'])

     

    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

    adddays(triggerBody()?['DateTimeReceived'],2,'yyyy-MM-dd')

     

    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

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],2,'yyyy-MM-dd')

     

    ---

     

    Case 1

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],3,'yyyy-MM-dd')

     

    ---

     

    Case 2

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],4,'yyyy-MM-dd')

     

    ---

     

    Case 3

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],5,'yyyy-MM-dd')

     

    ---

     

    Case 4

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],2,'yyyy-MM-dd')

     

    ---

     

    Case 5

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],2,'yyyy-MM-dd')

     

    ---

     

    Case 6

     

    Expression

    adddays(triggerBody()?['DateTimeReceived'],2,'yyyy-MM-dd')

     

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

  • Community Power Platform Member Profile Picture
    on at

    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!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard