Re: Problems with date()

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

 



And what exactly did you expect? Have you checked a calendar? The 31st of december 2001, 2002 and 2003 are Monday, Tuesday and Wednesday respectively. In other words. those days are more or less in the middle of the week 01. So, I would say that your results are absolutely right.

/frank
13 sep 2006 kl. 18.38 skrev Arno Kuhl:

I hope someone can help with this.

I'm trying to find the week number of the last week of the year.
I have the following code snippet:

$lastday = strtotime("31 December ".$year);
$lastdate = date("Y-m-d", $lastday);  // for testing
$lastweek = date(W, $lastday);

I put the $lastdate line in because I was convinced that $lastday must be
wrong, but it's correct!

When $year is 2000 I get an expected $lastweek of 52.
When $year is 2001, 2002, or 2003 the $lastweek is 01!
When $year is 2004 $lastweek is 53.
When $year is 2005 $lastweek is 52.

I haven't checked further than 2005.

Why do I get the weird lastweek values for 2001, 2002, and 2003?
I'm using PHP 4.3.4 on Win2000.

Arno

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



--
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