Make sure, you're using "yyyy" and not "YYYY" in your date format strings. Typically you want to use "yyyy" to represent a four-digit calendar year (e.g. "2021"), while "YYYY" represents a so called 'week year' - see below.
Typical use of calendar year:
date2str(2020-12-28, "MM/dd/yyyy") == "12/28/2020" (calendar year)
Week year:
date2str(2020-12-28, "YYYY") == "2021" (because Jan 1, 2021 is a Friday in that week and thus belongs to 2021)
If you noticed that dates in CloverDX are suddenly showing a different year that you would expect (for instance, 2020 instead of 2021) and these dates are suspiciously close to the year end/beginning you are most likely using a "week year" instead of a regular calendar "year" denotation in the time format of your CTL functions or metadata. The week year denotation in the time format is "YYYY" whereas the calendar year (which is most commonly used) is denoted as "yyyy". The first day of the first week (Sunday or Monday based on the locale) of a new year can often still belong to the old calendar year. For example, Monday 28th December 2020 is the first day of the first week of 2021 so it belongs to the week year 2021. In other words, if you use the "YYYY-MM-dd" format in CloverDX for this date, it will be displayed as 2021-12-28 which can cause confusion. By setting the format to "yyyy-MM-dd", you will get the desired result, i.e. 2020-12-28. Worth noting though is that the date value itself remains correct regardless of the date format.
Comments 0