Week Number One Ahead of Actual Week

Hi Guys,

I have the following '%ICUDateTime%YYYY/MM/dd - ww%' and it's producing a week number that's +1 of the current week.

How can I have it produce the correct week?


On my machine, this produces 2021/01/14 - 03, which is correct - this is the 3rd week of this month.

Hi Dan,

I believe Jan 14, 2021 falls within week 2. https://www.epochconverter.com/weeknumbers


On my machine it produces 2021/01/14 - 02

I'm in the UK - could it be something to do with region/locale settings?

Long story short:

  • YYYY and yyyy are different
  • you almost certainly should never use YYYY
  • you almost certainly should always use yyyy

Quoting the Keyboard Maestro Wiki for Dates and Times:

:warning: Do not use capital “Y” (year of “Week of Year”) unless you really mean it or you will get oddly strange results at the beginning/end of each year.

If you check the search results for 'ICUDateTime' for this forum lately, you'll see that this oddity has "bitten" several people lately.

1 Like

Hmm, I changed it to "%ICUDateTime%yyyy/MM/dd - ww%" and still, it's recording a week ahead.

Oddly enough, some apps (Calendar) say it's 3rd week, some apps (Itsycal, Busycal) say it's the 2nd week.

Week %ICUDateTime%ww - MMM% %ICUDateTimeMinus%0%Mondays%dd%-%ICUDateTimePlus%0%Sundays%dd%

I get:
Week 03 - Jan 11-17

Almighty Google says it's Week 2


1 Like

Interesting. I wonder if ICUDateTime is OS related or strictly KB. How are you seeing week 3 with Calendar?

Screen Shot 2021-01-16 at 8.40 AM
have turned on show week numbers in Calendar.app

I figured it out. In region settings, I switched calendar to use ISO instead of Gregorian and week number is now correct.


Just in case anybody comes across this post and can't change their default calendar to ISO 8601 (for me it messes with my OmniFocus), you can also just do some date math. For me, I solved it in the following way (using the example from above):

%ICUDateTime%YYYY/MM/dd% - %ICUDateTimeMinus%1%Weeks%ww%

Wikipedia page might be interesting reading. https://en.wikipedia.org/wiki/ISO_week_date Essentially it comes down to "how do we count the first week"? Is it the first full week, the 1st of Jan? It seems like ISO has decided that it's to do with the first Thursday in the year.


The discrepancies between Gregorian and ISO 8601 might be what has been messing with my week-number-based renaming macros for years. Like the OP and others, when I change my system Calendar, the resulting week number is changed (currently, 2021-11-02, from Week 45 [Gregorian] to Week 44 [8601]).

So, which is the preferred (normal? every day? mainstream?) system to use (in the U.S., at least)?

In the USA, I never hear anyone talk about "week of the year" , so I don’t think there is one agreed-upon preferred way.

1 Like

I'm not in the US, but if it came down to an argument about it, I think the ISO standard is probably more defensible.

1 Like

As an expansion on @tjluoma's judgement, which I, born, raised, and employed in the USA, agree, whenever it has come up, the consensus has been that WoY implies full week of business days. The first Week of the Year starts on the first Monday of the year. The previous week is the last week of the last year (perforce, the 52nd), or if you need, the "zero'th" week of current year. At least, that's the consensus among people with whom I worked. The rationale is that WoY is mostly used for binning, and the bins should be the same size -- that it is more useful to have bins the same size that straddle years than to have dissimilar size bins that do not. (Therefore sum by WoY's or by Y's, but not both, as their start and end days don't align.)

1 Like

So, which is the preferred (normal? every day? mainstream?) system to use (in the U.S., at least)?

I don't think there is one really. I just looked at the Mac's calendar app, which appears to use 1/1 as week 1, and Fantastical, which appears to use ISO. So my Mac can't even agree. :slight_smile:

I've typically used the week containing 1/1 as the first week, both because it's the easiest to understand and because I used to do a lot of work with a database that used it as default.

1 Like

Number of weeks in 2021 year is 52 weeks

43 weeks passed in 2021 year excluding current week #44

8 weeks left in 2021 year, until next 2022 year starts, excluding current week #44

Weeks are computed according United States calendar rules, Sunday first day and weeks are Sunday to Saturday

Week Numbers 2021 in United States - Savvy Time