How to set the format of date

3
Hi, I want to set up the date format to 'dd/mm/yyyy' for a date time field in my dataview. Can anyone please help how this can be achieved. I am using Mendix 2.5.4 Thanks & Regards, Rajnish Kumar
asked
4 answers
5

In addition to Samet's solution, which was indeed the way to do it before 2.5.4 and which will still work, a somewhat easier way was added in 2.5.4 which will allow you to display your date times in a custom fashion without the need to use additional String attributes.

For more information, you can see the documentation on it here.

Using this new functionality you should be able to choose 'Custom' as the display option on the date picker, and then define the format similarly to formatDateTime on the date picker itself. I believe the following would give the desired format:

'd/MM/yyy'

answered
2

The format of a datetime field will be based on your language settings. If you select English as your language, your date will be shown as dd/mm/yyyy. These localization settings are predefined by mendix. So if you just want to show your custom format, you could save the datetime as a string with formatDateTime.

answered
1

I tried to apply the 'dd/mm/yyyy' in project settings-->edit language-->custom date and time formatting --> date format

  • to override the 'mm/dd/yyyy' of english united states ,but it does not work !
answered
-1

Try this out. Works like a charm. Go to Project settings- Language Tab -Edit Language then input d/MM/yyy in the field for date format.

answered