how to remove time from UTC date formate - ReviewDate: 2019-06-02T18:30:00.000Z,

0
Hello Experts, I would like to inquire about removing the unnecessary time component from the UTC date format. I have noticed two scenarios: In the UI, the date is displayed perfectly as "2019-06-02". However, when attempting to export the data, it is stored in the format "ReviewDate": "2019-06-02T18:30:00.000Z". Could you please suggest any solutions to resolve this issue? My objective is to store the date in the database without including the time component.   thank you in advance    Regards Pushpendra
asked
2 answers
3

Hi Pushpendra,

 

It's not possible to store a datetime attribute without a time. This is the structure of the datetime in the database and can't be changed.

 

You can use the function trimToDays or trimToDaysUTC to make sure that your time will be set to 00;00.

Example: "2019-06-02T18:30:00.000Z" will turn into "2019-06-02T00:0:00.000Z".

 

See documentation here

 

How do you export the data?

 

 

answered
1

Additionally to Bjarns answer, Dates in Mendix are by default localized.

Which means that when I run a Mendix app (GMT +1) and select the date of to day in the frontend it will be 2024-03-08T00:00:00Z. But it will be stored in the data based with as UTC value and thus 2024-03-07T23:00:00Z

 

If localization isn't needed, just set the localization property of the DateTime attribute to NO. then the selected dateTime value will equal the stored dateTime value.

 

This learning path will give you more insight in how DateTime values are handled: https://academy.mendix.com/link/modules/374/lectures/3046/7.1-Introduction

answered