Issue with %ICUDateTime%YYYYMMdd%, outputs 2021

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 whereas YYYY specifies the year (of “Week of Year”), used in the ISO year-week calendar. In most cases, yyyy and YYYY 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…


  1. Nobody asked me.

  2. 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!