Handling British Summer time when querying SharePoint from Power Automate
This also applies to other TimeZones.
When you query SharePoint in Power Automate using steps like "Get Items" the raw information that is returned when you are working with dates and currently inside British Summer Time will be out by an hour.
Below I've created a step which runs Get Items and I add a compose to check the Created date:
Whenever you are handling dates from SharePoint in Power Automate you have to remember that the original value stored in SharePoint for date/time is the UTC value. Depending on your regional settings the value is converted for you when it's rendered.
Fear not! Power Automate has conversions, here's one way:
In the example above I'm taking the source Created date/time which is in UTC and converting it to my location - Dublin, Edinburgh, Lisbon, London. The expected Created time is returned:
Note: ("items('Apply_to_each)'?['Created'] is the Created date/time from SharePoint):
convertTimeZone( items('Apply_to_each')?['Created'] ,'GMT Standard Time', 'UTC','yyyy-MM-ddTHH:mm:ss')
This also counts when you are querying SharePoint date/time fields! So definitely store a converted date in UTC format if you are then using it in "Get Items" with an odata query.
E.g. if you make up your own specific time like 25/06/2023 @ 15:00BST you'll want to convert this to UTC first by doing the opposite of the above.
Hope it helps!
Comments
Post a Comment