Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: Tim MeagherHi,
The format: D-m-YY
Specifies a 1-2 digit day, followed by a 3 character month name followed by a 2-digit year.
If the fields do all have 2 digit days, then DD-m-YY should work, but my guess is that you have some fields with things like:
1-Jan-10
i.e. with a 1-digit day.
Therefore, the "DD" part won't work because it requires a 2-digit day field.
The output of this is then a date.
Dates are always
displayed as CCYY-MM-DD.
Therefore, 12-Jan-10 is being parsed as the 12th January 2010, which is then displayed as 2010-01-10 - which seems correct.
Note that while the date format is displayed in CCYY-MM-DD format, they are stored internally as a binary date format.
There is no way (to my knowledge) to change the way a date field is displayed.
If you want this to be displayed in a different manner, you will need to convert to a string object, at which point you are free to format them however you want.
For example, if you wanted to display the date as a String, formatted with 2 digit days, followed by 2 digit months, followed by the year (all separated with "/" characters), then you could use something like:
dateField = 'dateField'.date("D-m-YY")
dateFieldAsString = format("%02d",dateField.day())+"/"+format("%02d",dateField.month())+"/"+dateField.year()
emit dateFieldAsString as "DateStringField"
Does this help?