I am trying to convert a timestamp value with a time zone offset from ISO8601 format into a DateTime format.I am using the TextToDateTime() function.An example would be:
TextToDateTime("2020-06-26T10:30:00+02:00")
Which returns a value of 2020-06-26 08:30The expected result is: 2020-06-26 12:30
I would just like to understand if this is the result of some time zone conversion that I am not quite grasping, or could it be a bug?I am using a Traditional Web App.Both my server and the device time zones are set to UTC+0.
Hi Larissa,
Daryna is right. The first part of "2020-06-26T10:30:00+02:00" means that it's 10:30:00 on 26 June 2020 local time, the last part means that local time is two hours ahead ("+02:00") of UTC.
Since Traditional Web Apps are always assuming local time, and your local time is actually UTC, TextToDateTime() converts "2020-06-26T10:30:00+02:00" to 26 June 2020, 8:30:00. So there's no magic happening, it's a rather straightforward conversion of an ISO8601 date to local time (which happens to be UTC).
Why do you expect 2020-06-26 12:30?
When the time is 10:30 in the UTC+2 time zone, it is 8:30 in the UTC time zone.
Larissa le Roux wrote:
Hi try to use this component try to use this component TimezoneReactiveUtils.
Best regards
Hi All, thanks for the replies, I indeed understood the conversion wrong, it is much clearer now - thanks for explaining.
You're most welcome! Timezones are these pesky things that are difficult to grasp sometimes, I hope I increased your understanding a bit :).