Problem No of weeks returned by date function
| From: | Sukhwinder Singh | Date: | Thu, 10 Jun 2004 18:59:23 +0000 |
| Subject: | Problem No of weeks returned by date function | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-23948@lists.php.net to get a copy of this message | ||
Hello,
I want to display a report per week.
I am facing a problem with php date function.
date() function returns week 1 for a date in last year.
<?php
$ts = mktime(0, 0, 0, 12, 29, 2003);
echo date("W", $ts);
// returns 1. Is this a bug
?>
But mysql week function returns 53.
select week('2003-12-29', 1)
I am losing the data for week 53 because I have to display week using php
and then hits for that week using mysql records.
I am using PHP Version 4.3.6 on Windows 2000.
Is this a php bug where it is assumed that there can be just 52 weeks in a
year? If yes then how mysql displays week from 0 to 53?
--Sukhwinder Singh