How to extract year value as string in YYYY format from Datetime attribute

0
I have a requirement to convert the month end date time value in string in MMM, YYYY format. For example date value is 31/12/2020 should be converted into string value as Dec, 2020. I tried to use the below code and it was working fine for all the month except December month.  formatDateTimeUTC($datevalue,'MMM')+', '+formatDateTimeUTC($datevalue,'YYYY')     Any suggestion how to resolve this issue?
asked
3 answers
1

Hi,

 

have a look at https://docs.mendix.com/refguide/parse-and-format-date-function-calls

 

answered
3

Use yyyy instead of YYYY

and it is better to only call formatDateTimeUTC once:

formatDateTimeUTC($datevalue,'MMM, yyyy') 

You are not the only one with this issue. Lots of applications will be running into this error, or have been running into it.

See this for a demo: https://mydemoversion8-sandbox.mxapps.io/p/ff/FormatDateTime

answered
1

This is one of the most common date time errors that mendix developers make. For more details check: https://www.notion.so/gajduk/Common-date-time-mistakes-that-Mendix-developers-make-a5fd80fb1ca04affa44b6e6dc674ce20

 

answered