FormatDateTime give me unexpected results

While $Date = 2018-12-31 22:59:00.0 and Format = 'YYYY MM dd', the expression formatDateTime($Date, $Format) returns the unexpected result '2019 12 31'   Same with Date set to one day earlier.  
2 answers

Just like mentioned above you should use 'yyyy' in stead of 'YYYY'.

With yyyy you get the year from the date you are using.

With YYYY you get the year of the week your date is in.


In this case 2018-12-31 is on a Monday, the first week of 2019.


Today I experienced the same issue with formatting the date to a weeknumber.

In this case, the weeknumber needs to be based on a date in order to retrieve a project that is set for that week.

The startdate is February 9th 2019 (or 09-02-2019).


As shown, the formatDateTime does find the correct day of the week (6). However, when the week is retrieved using the same function, week 7 is generated instead of week 6 (which is correct).

The code for the variable WeekString is:

formatDateTime($StartDatum, ‘w’)

Using uppercase results this in returning a ‘2’, but that is definitely wrong?

Is this a wider known issue? Is there a workaround?