#43188 [Opn->Asn]: Daylight Savings Time Related Problem with Date()

From: Date: Sun, 11 Nov 2007 14:49:27 +0000
Subject: #43188 [Opn->Asn]: Daylight Savings Time Related Problem with Date()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-119443@lists.php.net to get a copy of this message
ID: 43188 Updated by: derick@php.net Reported By: ebrueggeman at gmail dot com -Status: Open +Status: Assigned Bug Type: Date/time related Operating System: Windows PHP Version: 5.2.4 -Assigned To: +Assigned To: derick Previous Comments: ------------------------------------------------------------------------ [2007-11-04 21:51:47] ebrueggeman at gmail dot com Description: ------------ The date() function is not accurately displaying output expected of dates during the 1 week long time before daylight savings time, likely because of the change in the start of daylight savings time from the year prior. Reproduce code: --------------- date_default_timezone_set ("America/New_York"); $receiptStamp=mktime(0, 0, 0, 10, 31, 2007); $modStamp= $receiptStamp + (5 * 24 * 60 * 60); /* Addition of 5 days of time */ echo date('m/d/Y', $modStamp) . '<br>'; /* prints 11/04/2007 */ $dateObject=new DateTime("10/31/2007"); $dateObject->modify("+5 day"); echo date_format( $dateObject, 'm/d/Y' ). '<br>'; /* prints 11/05/2007 */ /*After the old daylight savings crossover week*/ $dateObject=new DateTime("11/7/2007"); $dateObject->modify("+5 day"); echo date_format( $dateObject, 'm/d/Y' ). '<br>'; /* prints 11/12/2007 */ $receiptStamp=mktime(0, 0, 0, 11, 7, 2007); $modStamp= $receiptStamp + (5 * 24 * 60 * 60); /* Addition of 5 days of time */ echo date('m/d/Y', $modStamp). '<br>'; Expected result: ---------------- 11/05/2007 11/05/2007 11/12/2007 11/12/2007 Actual result: -------------- 11/04/2007 11/05/2007 11/12/2007 11/12/2007 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43188&edit=1

« previous php.bugs (#119443) next »