RE: PHP date: ISO year = loss of hair

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Andrew Ballard [mailto:aballard@xxxxxxxxx] 
Sent: 14 December 2007 04:38
To: PHP General list
Subject: Re:  PHP date: ISO year = loss of hair

If the last week of the year is the one that has Dec. 28 in it, and the last
week number is 52, then Dec. 30 SHOULD return 1. Dec. 30 is not in the 53rd
week of 2007; it is in the first week of 2008 according to the ISO, so a
week number of 1 is correct.

Andrew

--

You're right. I didn't spell out what I was doing. My script calculates week
53 for 30 December 2007 (at least now it does), week 54 for 9 January 2008,
week 55 for 16 January 2008 etc, if I start calculating from some date in
2007. It calculates the number of weeks between dates. The problem was if I
specifically used 30 or 31 December 2007 in the calculation it fell over -
if the end date was 30/31 Dec 07 I got 52 weeks less than the actual count,
and if the start date was 30/31 Dec 07 I got 52 weeks more than the actual
count. All the other dates worked fine, and would have worked fine for the
next 4 years. The next time "week 53" occurs is in 2012.

Cheers
Arno

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux