Display date in string format without its time

Hi,   I want to return a string attribute with value of date but without time display. How to achieve that please guide. As I convert date to string format it returns date with time & while using trimToDays I got the below result as shown below:   Additionally I want this formatted date in my customized format as 17-Dec-2021 ~ 27-Dec-2021. Thanks & regards, Kirti  
2 answers

Hi Kirti,

All dates in mendix are datetimes in the backend. You can convert this to a string by using formatDateTime, see Parse & Format Date Function Calls - Studio Pro 9 Guide | Mendix Documentation for documentation.

You can specify the format you want, e.g. formatDateTime($YourDate,'MM-dd-yyyy').

Note that if you are using it for displaying purposes in mendix, you can also choose the format in the properties where you show this attribute/text.

Hope this helps!


Mendix accepts Date time only.

  • When you want display in your custom format on a page, then you can customize the widget directly on the page itself like below

  • If you want to retrieve or return date only in Microflow then use formatDate https://docs.mendix.com/refguide/parse-and-format-date-function-calls#5-formatdate-utc