#29734 [Opn->Bgs]: Function GetDate interprets 2 different timestamps as same date
| From: | derick@php.net | Date: | Wed, 18 Aug 2004 13:47:08 +0000 |
| Subject: | #29734 [Opn->Bgs]: Function GetDate interprets 2 different timestamps as same date | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64853@lists.php.net to get a copy of this message | ||
ID: 29734
Updated by: derick@php.net
Reported By: jlamas at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Linux
PHP Version: 4.3.8
New Comment:
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.
This has something to do with DST changeover, consult
http://php.net/support.php for more information.
Previous Comments:
------------------------------------------------------------------------
[2004-08-18 15:17:59] jlamas at gmail dot com
Description:
------------
The function GetDate interprets the both timestamps as October 17th,
2004.
The timestamps are: 1097895600 and 1097978400
Reproduce code:
---------------
$tbDataInicial = '2004-10-01';
$tbDataFinal_temp = '2004-10-31';
while ($sDataLoop != $tbDataFinal_temp)
{
if ($sDataLoop == "")
{$sDataLoop=$tbDataInicial;}
//Add one more day
$nTimeStamp=strtotime($sDataLoop);
$sDataLoop = getdate($nTimeStamp);
$sDataLoop=date("Y-m-d",mktime(0,0,0,$sDataLoop['mon'],$sDataLoop['mday']+1,$sDataLoop['year']));
}
Expected result:
----------------
The while should go through the parameters $tbDataInicial and
$tbDataFinal that represents the begin and end dates respectively.
Actual result:
--------------
This generates and infinite loop since $sDataLoop get stucked on the
day October 17th, 2004.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29734&edit=1