I recently came across a big problem, as I have a system that's paying the customers weekly.
As we all know, a year has 52 weeks, and there are standards for it. I'm using PHP aka date('W') to get the week number from a date, that calculates that according to the standard ISO-8601.
Here are some references:
But here's the ISSUE: year 2009 has 53 weeks. It seems that through the Gregorian calendar within 400 years there are 71 years that have 53 weeks. That's one thing I didn't know, and probably many didn't as well.
According to Wikipedia:
2009-12-31 is 2009-W53-4 (ISO year 2009 has 53 weeks, extending the Gregorian year 2009, which starts and ends with Thursday, at both ends with three days).
and the date function in PHP totally respects it.
If you look into MS Outlook, and show day of the week in the calendar view, it will appear 52 weeks considering 28 DEC 2009 to 03 JAN 2010 week 1. Is this another standard? The US standard or something?
If so, then why PHP can't support it? Did anyone make a function that supported this?
Is it correct to have 53 weeks? We have both European and US clients.
Depending on your locale / region you might have the non-ISO behaviour by default. To change it, go to System Preferences –> Language & Region –> Calendar and change it from Gregorian to ISO 8601 . This setting applies to other apps as well, such as Apple's Calendar.
All weeks in the ISO-8601 Week-Based calendar have exactly 7 days, start on a Monday, and each week belongs to single year. Unlike the Gregorian calendar, there are no weeks that extend across years. Each ISO-8601 year is either a Long or a Short year, with 52 or 53 weeks depending on when the ISO-8601 year begins.
The week number is the count of weeks that have passed in the year up to the end of the current week. For example, if it's the second week of the year, the week number is 2. The week where Jan 1 falls counts as the first week for the following year.
Outlook doesn't follow any sort of standard for week numbering. It has two settings that determine week numbering, called "First day of week" and "First week of year".
By setting "First day of week" to Monday and "First week of year" to "First 4-day week" the ISO standard can be simulated.
Each user will have to make this adjustment to follow the ISO standard.
I know of no separate US standard, and, apparently, neither does Outlook.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With