CurrentDateTime daylight saving time problem

Hi all, I’m using a check on the currentdatetime in an API call. So it obviously retruns the UTC time. But because of daylight savings time the gap between the actual currentdatetime and the utc currentdatetime changes.   What would be a way for me to make sure the gap between these will always be the same.    Basically I’m trying to check some openingtimes for a location based on currentdatetime in an API call. But now I have to change this microflow everytime daylight saving changes.
3 answers

What do you need to send? The localtime component or the UTC component?

If you want to use localtime and your API accepts the datetime as a string, you could use formatDateTime to force the system to use localtime.

If you need to have it as DateTime, you can use a combination of parseDateTimeUTC and formatDateTime to store your local time as utc.

parseDateTimeUTC(formatDateTime(<YourDateTime>)) //for example. If you need to have a specific accuracy, you may want to add a format string


If you have a location (latitude and longitude), you can use the google Time zone API to get the current offset for that location with respect to UTC time.
Then you can add the offset to your stored local time to get a value that you can compare against CurrentDateTime.


My approach is to set my DateTime attributes to localize = false.

Since in most cases the offset between regions doesn't matter at all.

By doing this, the show DateTime equals the DB stored DateTime = UTC. Which solves a lot of issues.

FYI: the DateTime is always stored UTC, but presented in server, app, or user timezone depending on setting.

More tips: