I am looking to query a SharePoint List and get all items that were created today. Once it gets into the evening, the UTC for "Current Date and Time" gets into the next day. (i.e. when I run it at 09-09-2020 9:50pm EST, Current Date time returns 2020-09-10T01:50:46Z).
I know I can convert that to a string and convert to my timezone, but then how do I convert that back to a DateTime object? The query requires a DateTime since the SP field is a DateTime
Best answer by Gavin-Adams
I would work with the date fields both for query and what is returned from SharePoint in UTC (zulu timezone).
Then when you need to present a date to a user eg in an email you can use the Format Date to String action to convert the GMT date into a local timezone and with a nicer display format and store in a string variable.
You can then add that string variable into the email notification body, etc.
I would work with the date fields both for query and what is returned from SharePoint in UTC (zulu timezone).
Then when you need to present a date to a user eg in an email you can use the Format Date to String action to convert the GMT date into a local timezone and with a nicer display format and store in a string variable.
You can then add that string variable into the email notification body, etc.