%ICUDateTimeFor% Year Problem


I have an action that sets date and time to 1hr after the current time. It worked very well. But recently (maybe since upgrading to Big Sur), the Year becomes 2021, which is the next year, not this year. Can anyone explain why and how to fix it?


This is the code:
%ICUDateTimeFor%NOW() + 3600%YYYY-MM-dd%T%ICUDateTimeFor%NOW() + 3600%HH:mm:ss%

(I added 3600s because I want to set the default time to 1hr after the current time.)

The following is the screenshot of the action:

This is the result of the action:

As you can see, the year is 2021, not 2020.

’tis the season… when people realize that YYYY and yyyy are different.

Long story short, you want yyyy not YYYY. They are the same except for the first week in January and last week in December, where they are (sometimes) different.

(This isn’t Keyboard Maestro’s fault, BTW, the actual specification has this distinction in it, which I find absurd and can’t imagine anyone actually wanting to use, but nobody asked my opinion before they implemented it.)

Here’s one reference: 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.


Indeed I did not know there is a difference in "YYYY" and "yyyy".
Now I can also see that KM wiki page also has a footnote on it, which says

Do not use capital Y (year of “Week of Year”)!

Glad to learn something new before the year ends.

Just noticed that the same question has been asked here.

Is there a way to remove this post?

There might be, but I wouldn’t worry about it. Maybe someone in the future will find this post (or the forum software will show it as recommended) when they would have missed the other one, and vice versa.

It’s one thing to have two long separate threads about the same issue, but I don’t think this is one of those cases. IMO.

1 Like