RE: Problem No of weeks returned by date function

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

 



I guess both function just have different interpretation (and none of them
are incorrect), the best thing you can do is to translate any occurence of
week 53 to week 1, that should solve your problem of losing data in the
start-end case.

An alternative solution is to explain for the customer how it works (that
end cases always are tricky and casues problem), and tell them that
"missing" data from week 1 can be found in week 53. And if they complain,
then explain that "this is a complicated tech matter, but of course if you
put $$.$$$:- on the table I can always fix it".


-----Original Message-----
From: Sukhwinder Singh
To: php-windows@xxxxxxxxxxxxx
Sent: 10-6-2004 20:59
Subject:  Problem No of weeks returned by date function

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

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux