[Hint] ISO 8601 compliant week numbers

Last week one of our customers noticed that the Calendar module in our CRM application shows incorrect week numbers. Since it was a really old module we were pretty sure that they were correct - isn’t the PHP’s date function supposed to do all the dirty work for us?

Later on we came up with Polish government’s norm (suggestion, to be exact) that states that the first week of the year is the first week which has at least 4 days in the year (and since it’s ISO 8601 compliant, our task was quite easy). We had to remove all the occurrences of:

$var = date('W');

and replace them with:

$var = strftime('%V');

since the result of strftime(’%V’) is ISO 8601 compliant.

0 Responses to “[Hint] ISO 8601 compliant week numbers”


  1. No Comments

Leave a Reply