cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jpineiro
Frequent Visitor

Flow Notification when new email between certain times? @contains(triggerBody()?['DateTimeReceived'

How can we code, when we get email between 7pm and 9pm?

 

This is what advanced contain produced..

 

@contains(triggerBody()?['DateTimeReceived'], '') 

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @Jpineiro,

 

Microsoft Flow handles time in UTC format, so in order to make the flow to work with your local timezone, here we take use of the addhours function to add the UTC offset.

For example, in Beijing TimeZone,  the formula below would Add 8 hours.

Addhours(triggerBody()?['DateTimeReceived'],8,'HH:ss')

Please find your timezone and then modify the 8 with the UTC offset for your timezone.

So the whole formula for the condition should be:

@and(
        GreaterOrequals(
                   Addhours(triggerBody()?['DateTimeReceived'],UTCoffset,'HH:ss'),
                   formatDateTime('19:00','HH:ss')
          ),
         lessOrEquals(
                   Addhours(triggerBody()?['DateTimeReceived'],UTCoffset,'HH:ss'),
                   formatDateTime('21:00','HH:ss')
           )
      )

Regards,

Michael

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

Thank You.  I'm in EST, and have been trying this (this morning) with no success.  Condition always comes back false though email is recieved between 6am and 10am.  I tried -5 too, with no luck. Thanks!

 

@and(
        GreaterOrequals(
                   Addhours(triggerBody()?['DateTimeReceived'],5,'HH:ss'),
                   formatDateTime('6:00','HH:ss')
          ),
         lessOrEquals(
                   Addhours(triggerBody()?['DateTimeReceived'],5,'HH:ss'),
                   formatDateTime('10:00','HH:ss')
           )
      )

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

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.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,728)