cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
oaghaei
Resolver I
Resolver I

Dates in the sharepoint list are off by a day when generated in an email via flow

Issue: Some (not all) dates are piped into an email from a sharepoint list are incorrect (off by a day)

Here is my flow: 

oaghaei_0-1660264161137.png

Here is what I have for the deadline: 

formatDateTime(item()?['Deadline'],'MM/dd/yyyy')
 
This flow creates a list that I get in my email that looks like this: 
oaghaei_1-1660264331455.png

However, some dates are imported from Sharepoint correctly, while others are off by a day (one day later than they actually are). In the same example, the highlighted dates are behind one day. 

oaghaei_2-1660264425117.png

 

I wonder if this is because I need to convert the time? If so, is there a formula someone can help me figure out how to write it to ensure dates are all coming in correctly?

Thank you in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @oaghaei ,

 

Maybe you could try to convert time zone using expression instead of Action. 

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#c... 

 

I have made a simple test for your reference. 

 

1. Here is my SharePoint list. 

vyujincuimsft_0-1660629705315.png

2. Here is my flow. 

formatDateTime(item()?['Deadline'],'MM/dd/yyyy') 
convertFromUtc(item()?['Deadline'],'Pacific Standard Time','MM/dd/yyyy') 
convertTimeZone(item()?['Deadline'],'UTC','Pacific Standard Time','MM/dd/yyyy') 
addHours(item()?['Deadline'],-7,'MM/dd/yyyy') 

vyujincuimsft_2-1660629606522.png

Result Screenshot: 

vyujincuimsft_3-1660629606523.png

 

 

Best Regards, 
Charlie Choi 

View solution in original post

8 REPLIES 8
MarconettiMarco
Super User
Super User

Hello @oaghaei ,

please try to use the "Convert time zone" action:

 

MarconettiMarco_0-1660285542404.png

 

 

If I have answered your question, please mark my post as Solved.
If you like my response, please give it a Thumbs Up.

BR,

Marco

Hello @MarconettiMarco  thank you for your reply. I did try that in the past, but I ran into this error. Once I convert the time then i cant seem to be able to use "current item" that contains the converted time in the select function. 

oaghaei_0-1660315782227.png

 

Hello @oaghaei, you should put the output form the previous action instead of the current item.

 

BR,

Marco

@MarconettiMarco When I move all subsequent outputs into the previous action under "Apply to each", I end up with multiple emails (one per each line item), instead of in a table in one email.

oaghaei_0-1660320073797.png

 

v-yujincui-msft
Community Support
Community Support

Hi @oaghaei ,

 

Maybe you could try to convert time zone using expression instead of Action. 

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#c... 

 

I have made a simple test for your reference. 

 

1. Here is my SharePoint list. 

vyujincuimsft_0-1660629705315.png

2. Here is my flow. 

formatDateTime(item()?['Deadline'],'MM/dd/yyyy') 
convertFromUtc(item()?['Deadline'],'Pacific Standard Time','MM/dd/yyyy') 
convertTimeZone(item()?['Deadline'],'UTC','Pacific Standard Time','MM/dd/yyyy') 
addHours(item()?['Deadline'],-7,'MM/dd/yyyy') 

vyujincuimsft_2-1660629606522.png

Result Screenshot: 

vyujincuimsft_3-1660629606523.png

 

 

Best Regards, 
Charlie Choi 

oaghaei
Resolver I
Resolver I

@v-yujincui-msft  Charlie, you are awesome! The expression is what I needed. I used the expression for Deadline 1. Now, can you tell me what is the purpose of the Deadline 2 and 3 expressions since they all produce the same outcome? Or are they all different ways of getting to the same result? I wonder if you have a preference. 
Again, thank you so much!!

v-yujincui-msft
Community Support
Community Support

Hi @oaghaei ,

 

I just want to give you more options, all three expressions are available. I prefer to use the first, followed by the second.

 

 

Best Regards,

Charlie Choi

oaghaei
Resolver I
Resolver I

@v-yujincui-msft  - got it, makes sense. Thanks so much again!! I appreciate it. 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

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

Users online (1,345)