This week is the first week of the new year. That is the right week number.
PS: Last week was #52: echo date('W', strtotime('-1 week'));
Output: 52
. A year only has 52 weeks so...
문제
date_default_timezone_set('Europe/Helsinki');
$now = strtotime('now'); // 1388430373
$weekNumber = date('W', $now);
var_dump($weekNumber);
Why this code shows 01
?
It's now 30th december 2013
How to get right
week number?
해결책
This week is the first week of the new year. That is the right week number.
PS: Last week was #52: echo date('W', strtotime('-1 week'));
Output: 52
. A year only has 52 weeks so...
다른 팁
ISO 8601 week number is based on WEEK 01 which is
which is
where a week is defined as beginning with Monday and ending with Sunday
EDIT
Depending on your definition of week number, you might consider
$weekNumber = floor(date('z', $now) / 7) + 1;
which will give the number of 7-day periods since 1st January, but it will vary from year to year which day of the week is the week start day