#29065 [Csd->Bgs]: Some wrong dates when using gtdate()/mktime()
ID: 29065
Updated by: tony2001@php.net
Reported By: ehavet at yahoo dot fr
-Status: Closed
+Status: Bogus
Bug Type: Date/time related
Operating System: Linux 2.4.16C12
PHP Version: 4.3.6
New Comment:
not a bug -> bogus
Previous Comments:
------------------------------------------------------------------------
[2004-07-08 21:51:33] ehavet at yahoo dot fr
OK, the daylight savings is the reason.
Thank you and sorry about that
------------------------------------------------------------------------
[2004-07-08 21:22:22] ehavet at yahoo dot fr
Daylight savings OK
That means it occurs every 6 years (daylight savings & leap year). But
:
1- using getdate()
1993 -> 1999 => 6 years
1999 -> 2004 => 5 years
2004 -> 2010 => 6 years
2- using date()
1993 => not noticed
1999 -> 2004 => 5 years
2004 => 2010 => 6 years
There is not regular interval. I don't understand
------------------------------------------------------------------------
[2004-07-08 20:22:45] pollita@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.
------------------------------------------------------------------------
[2004-07-08 18:49:43] ehavet at yahoo dot fr
Description:
------------
When you want to display each 10/31/Year plus 1 day, you've got
sometimes 10/31/Year instead of 11/01/Year.
Noticed on PHP 4.3.3 (ISP linux server) and PHP 4.3.6 (WinXP personal
system)
Getting the date with date("m/d/Y", mktime(0,0,0,10,31,$i)+(24*3600));
gives the same result exept for 11/1/1993
Reproduce code:
---------------
<?php
for ($i = 1990 ;$i < 2011 ; $i++) {
$date = getdate(mktime(0,0,0,10,31,$i)+(24*3600));
echo
$date['mon']."/".$date['mday']."/".$date['year']."\n";
}
?>
Expected result:
----------------
11/1/1990
11/1/1991
11/1/1992
11/1/1993
11/1/1994
11/1/1995
11/1/1996
11/1/1997
11/1/1998
11/1/1999
11/1/2000
...
Actual result:
--------------
11/1/1990
11/1/1991
11/1/1992
10/31/1993
11/1/1994
11/1/1995
11/1/1996
11/1/1997
11/1/1998
10/31/1999
11/1/2000
11/1/2001
11/1/2002
11/1/2003
10/31/2004
11/1/2005
11/1/2006
11/1/2007
11/1/2008
11/1/2009
10/31/2010
11/1/2011
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29065&edit=1
Thread (5 messages)