After using it without issues, this macro now enters Next year:
%ICUDateTime%YYYYMMdd% --> 20211228
instead of 20201228
Any idea why?
After using it without issues, this macro now enters Next year:
%ICUDateTime%YYYYMMdd% --> 20211228
instead of 20201228
Any idea why?
Youâve run into a very common mistake: yyyy
and YYYY
are different.
Quoting: Use Format Strings to Specify Custom Formats:
A common mistake is to use
YYYY
.yyyy
specifies the calendar year whereasYYYY
specifies the year (of âWeek of Yearâ), used in the ISO year-week calendar. In most cases,yyyy
andYYYY
yield the same number, however they may be different. Typically you should use the calendar year.
thanks @tjluoma!
Youâre welcome. I remember reading that a few years ago and thinking âI wonder how many people actually use YYYY
vs how many hours and hours of debugging have been spent trying to figure out why YYYY
was giving the âwrongâ year.â
I canât imagine too many people actually needing what YYYY
does and I imagine most people always want what yyyy
doesâŚ
But:
Nobody asked me.
Itâs probably too late to change it now.
I always think this to be in the ballpark of the GDP of a small country!