Why formatDateTimeUTC changes the date?

1
I’m working on a simple microflow that should loop through all days in a range between StartDay and EndDay and detect if it’s a workday or a weekend.  I noticed that it returns wrong results, and after some debugging found out that the problem is that after converting the date time into UTC time the date is changing to one day earlier.   So I select a date 2022-12-03, it’s Saturday, so this expression below should return false (because Saturday is 6): parseInteger(formatDateTimeUTC($RequestedDate, 'u')) <=5   However, it returns true. As I understand, the expression changes the date, because after it the date becomes: UTC time: 2022-12-02 22:00:00.000 Session time: 2022-12-03 00:00:00.000 +0200 And also I noticed that it is quite inconsistent, sometimes it works right, and sometimes it works wrong. As a result, it can convert 2 different consequent days as the same date (probably because one day was converted right and another day converted wrong).   Why is it happening and how can I fix it?
asked
1 answers
2

You might want to read this documentation: https://docs.mendix.com/refguide/datetime-handling-faq/

 

Regards,
Ronald

 

answered