KB Article #180959
Year evaluation in date function
Problem
The ${date("YYMMdd")} function is evaluated wrong between 29/12/2019 and 31/12/2019. SecureTransport evaluates this specific date format pattern correctly to "191228" up until 28th of December, while from the very next day it will return "201229" instead of "191229". In other words - the YY in the date function resolves to 19 till 28th of December while between 29th and 31st of December it is resolved to 20 i.e. 2020.
Resolution
SecureTransport uses Java's SimpleDateFormat class for formatting and parsing dates. As per its documentation, yy is the calendar year, while YY is the week year. The week year is defined to begin at the beginning of the week that contains the year's first Thursday, thus the week containing the days between 29th and 31st of December 2019 is considered to belong to the year 2020.
For evaluating the calendar year corectly, the following expressions are to be used:
${date("yyMMdd")} or ${date("yyyyMMdd")}
Reference: Java Simple Date Format