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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,048)