Handling Date time in message definitions

Hi all, i have a problem with exporting data to a json by message definition. The standard export of a datetime attribute is a timestamp (2022-05-27T12:39:38.337Z). I would prefer a format like “yyyyMMddhhmmss”. Does anyone has an idea how to manage that. I don’t want to create my own export json as template, because it is huge and complicated. Thanks in advance.
2 answers

You shoul use a parseDateTime function or a formatDateTime function based on what type you have. If you have a string you need a parseDateTime($variable, ‘yyyy-MM-dd-hh-mm-ss’) and the output will be a DateTime.

Same on formatDateTime.



In Message definition, under example value, you can give the sample value as shown below.


The below are the format allowed in Mendix.

If the your required format is not available, then need to create a string attribute and map the respective value(your format)