cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kylep
Level: Powered On

How does the Outlook 365 search determine "received:today" and "received:yesterday?"

Does the search use server time?

 

Does "recieved:today" include the past 24 hours from the time the search is run?

 

We're having inconsistent results when using "received:today" and "received:yesterday" so we're trying to figure out how it's searching.  

 

Example: We're running a "received:today" email search through Flow around 8p local time and it finds an email sent at 6p, but it's not finding emails sent at 3a and 6a.  

 

When I run a manual email search using "received:today" at 11a today it's finding emails from 2p yesterday.  I'm assuming the server time is 3 hours ahead of us, but why wouldn't the above search work?

7 REPLIES 7
Community Support Team
Community Support Team

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

Hi @ kylep,

 

Could you please share a screenshot of the configuration of your flow?

 

Do you want to search the emails that is received at today with local time?

All times in Microsoft Flow are in Universal Time (UTC) by default.

Does the UTC time 3 hours ahead of your local time?

 

If you would like to search the emails that is received at today with local time, such as if search the emails that is received from time of 00:00 to 23:59 today with local time, you could take a try to convert the time as screenshot below:

Capture.PNG

 

 

The expression in the condition as below:

@and(greater(items('Apply_to_each')?['DateTimeReceived'], addHours(body('Convert_time_zone'), -3)),less(items('Apply_to_each')?['DateTimeReceived'], addHours(body('Convert_time_zone_2'), -3)))

 

If the UTC time 8 hours ahead of your local time, you could modify the expression in the condition as below:

@and(greater(items('Apply_to_each')?['DateTimeReceived'], addHours(body('Convert_time_zone'), -8)),less(items('Apply_to_each')?['DateTimeReceived'], addHours(body('Convert_time_zone_2'), -8)))

 

The flow would run successfully as screenshot below:

Capture.PNG

 

 

 

Regards,
Alice Zhang

kylep
Level: Powered On

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

Is it possible to search for emails in the last 24 hours?

Community Support Team
Community Support Team

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

Hi @ kylep,

 

 

If you would like to serch for the emails in the last 24 hours from the time now, you could create the flow as below:

Capture.PNG

 

The expression in the condition as below:

@greater(items('Apply_to_each')?['DateTimeReceived'], addHours(utcNow(), -24))

 

The flow would runsuccessfully as below:

Capture.PNG

 

Regards,
Alice Zhang

 

kylep
Level: Powered On

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

How do we post images here?

 

Our flow goes like this:

 

Recurrence: Runs once a week at 19:00

Get emails | Search query: (from:sender@outside.com)AND(subject:servername)AND(received:today) | Top: 1

Condition: @empty(body('Get_emails'))

If yes: Send email

If no: Do nothing

 

We want to search the last 24 hours from 19:00. Emails are sent daily so we don't want to grab emails from before the 24 hour window.

 

Will the @greater(items('Apply_to_each')?['DateTimeReceived'], addHours(utcNow(), -24)) work?

Community Support Team
Community Support Team

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

Hi @kylep,

 

For you "Recurrence: Runs once a week at 19:00" and "We want to search the last 24 hours from 19:00",could you explain more about how frequency would your flow run?Does the flow would run every week or every day?

If the flow would run every week,please choose on which day the flow would run and set the trigger as below:

Capture.PNG

 

 

If the flow would run every day,please set the trigger as below:

 

Capture.PNG

In addition,if you would like to check if there are email arrives from the last 24 hours from19:00,and the email is send by "sender@outside.com", the email's subject is "servername", and if the email exists,you would send the email,you could take a try to create a flow as below:

Capture.PNG

Capture.PNG

 

The expression in the Conditionas below:

 

@and(and(equals(items('Apply_to_each')?['From'], 'sender@outside.com'),equals(items('Apply_to_each')['Subject'], 'servername')),greater(items('Apply_to_each')?['DateTimeReceived'], addHours(utcNow(), -24)))

If there are email arrives from the last 24 hours from19:00,and the email is send by "sender@outside.com", the email's subject is "servername", and if the email exists, the result of condition2 would be true,and the flow would run successfully as below:

Capture.PNG

 

Please take a try and let me know if your issue are solved.

 

 

 

Regards,
Alice Zhang

anhthuch4ng
Level 8

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

Hi @kylep,

 

You should be able to upload photos to your forum posts now!

 

Have you had a chance to apply @v-yuazh-msft's suggestions to your Flow above?
If yes and you found that solution to be satisfactory, please go ahead and mark @v-yuazh-msft's reply as the "Accepted Solution". 🙂


Happy Flowing,

-AT (Flow Community Admin)

kylep
Level: Powered On

Re: How does the Outlook 365 search determine "received:today" and "received:yesterda

What is Base time?

 

The solution won't work, because we're getting the emails before any variables are being initialized.

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,252)