PHP date: ISO year = loss of hair

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

 



I'm battling with getting the last week number using date(W, $unixdate). If
the date is 30 December 2007 ($unixdate=1198965600) then date(W, $unixdate)
returns 01. I know that according to the ISO spec, the last week of the ISO
year has 28 December in it, so in this particular case the last week number
of the ISO year is 52. However 30 December is in the following week, week
53. How do I get the correct value of 53 for 30 December 2007? 

I'm thinking along the lines of: if the date is greater than 28 December
then use the week number of 28 December; then check every day between 28
December and the date to see if a Sunday occurs and if so add one to the
week number. It looks like it will work but seems ridiculously laboured for
such a simple issue. Am I overlooking something obvious here - is there
something I've missed about PHP date? Any pointers would be greatly
appreciated.

Thanks
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