ZumbaJr
asked on
date("W") returns 52 to first days in a year
Hi Experts!
Why first days of year can be in a week of previous year when using:
echo date("W", strtotime("2011-01-01"));
It returns 52.
Somebody can help me to fix it?
Thanks in advance!
Why first days of year can be in a week of previous year when using:
echo date("W", strtotime("2011-01-01"));
It returns 52.
Somebody can help me to fix it?
Thanks in advance!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The issue is that the weeks start on Monday. http://php.net/manual/en/function.date.php
Open in new window
January 1st and 2nd thus belong to 2010 because they are before the first Monday. 52 is correct.