
Announcements
I created SharePoint list that when a new item is created it triggers a flow with an approval component. Everything work just fine except that when I try to reformat the date/time for the StartDateTime and EndDateTime columns to a more readable format, the formatDateTime() keeps changing the time zone. For example. I create an event called Mardi Gras - New Orleans. The StartDateTime is 12/20/2022 8:00AM. I enter that date/time in the SharePoint form, and it shows correctly in the list. The issue is that when I trigger the flow with the approval and I try to format the date/time using:
formatDateTime(triggerOutputs()?['body/StartDateTime'],'MM/dd/yyyy hh:mm tt')
It adds 6 hours to the time, showing 12/20/2022 2:00PM in the approval notification.
How can I reformat the date/time without changing the time zone? The issue is that today the event is in New Orleans, but Tomorrow, may be in Los Angeles. I can't use "Convert time zone" in flow, because I'll never know what the time zone for the person receiving the invitation or the approval email will be.
Thanks.
Hi @emfuentes27 ,
I don't believe that the formatDateTime function will change the time.
SharePoint can set the time zone, and the datetime fetched by Flow will be automatically converted to UTC time.
Sample:
This is my sharepoint time zone setting (UTC+8):
You will see the flow shows the UTC datetime.
Best Regards,
Wearsky