Date and Time Function

1
Hi I have a requirement, where I need to check if entered date exist in holiday list. I have an separate entity for holiday list. So far I have created a microflow where I retrieve the holiday list and iterate over the list and check if entered date exist in the list. Issue here is , the dates of holiday list is not retrieved correctly. It retrieves a day before the specified date. Could not find what exactly is the problem here. Any suggestions please.
asked
2 answers
0

Hi Sadhana,

 

The issue you are facing has to do with the fact that Menidx stores all the dateTime values on UTC time, so if your input is 19-03-2023 and your timezone for example is +5, mendix stores in the database 18:03-2023 19:00:00. This is becasue it caculates back to utc, which is time zone 0.

 

So in order to validate the correct day from thet database set your check your date using UTC, for example FormatDateTimeUTC.

 

I would strong recoomend to not disable time zone settings, since Mendix will fall back on your computer's time zone, and does not take into account daylight saving time.

Good luck with it, I hope this will help
Jan

answered
0

Hi Sadhana,

 

You might want to check out the learning path I linked below. 

If all your users are within the same timezone, I would turn off localization and use the formatDateTimeUTC function. Only downside is that this does not handle daylight savings. But for your use-case, this isn't necessary.

 

https://academy.mendix.com/link/modules/374/lectures/3047/7.2-DateTime-Attribute

answered