Re: Calendar/Date
| From: | Hans Åhlin | Date: | Thu, 19 Mar 2009 00:41:46 +0000 |
| Subject: | Re: Calendar/Date | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-290263@lists.php.net to get a copy of this message | ||
Weeks in a year is 52 or 53
Days in a year is 365 and if a leap year 366
If (
(365 (Days Of a year) * (Years From 1940)) + (Number of leap years
since 1940, (Years From 1940 / 4) (if its a Leap year -1)) + ((Days
From 01-01) + 1) % 7 = (0-6 where 0 = Monday)
) is less then 3 (Thursday) then its in week nr 01 else if equal to 4
(Friday) its week 53 else its week 52
http://threesides.kronan-net.com/2008/08/04/date-calculation-algorithm/
--
MvH / Hans Åhlin - www.kronan-net.com