Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0a4

Bug #16434 Date object incorrectly loaded with UTC date/time minus 2 hours
Submitted: 2009-07-13 17:34 UTC
From: joebarh Assigned:
Status: Open Package: Date (version 1.4.7)
PHP Version: 5.2.5 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2009-07-13 17:34 UTC] joebarh (joe barh)
Description: ------------ D:\PHP528>pear version PEAR Version: 1.8.1 PHP Version: 5.2.8 Zend Engine Version: 2.2.0 Running on: Windows NT xxxx 5.1 build 2600 I am based in Switzerland, TZ = Europe/Zurich Problem is that the instance of Date I create is loaded with the UTC date/time minus 2 hours interestingly enough, a dump of the object shows that internally the Date_TimeZone object is properly set to represent an UTC date/time Test script: --------------- require_once 'D:\PHP528\pear\Date.php'; // X-WR-TIMEZONE:Europe/Zurich //20090606T190000Z // gives 9pm Europe/Zurich //20090607T000000Z //gives 2am Europe/Zurich $now = new Date("20090606T190000Z"); /Z means UTC echo $now->getDate(); var_dump($now); Expected result: ---------------- 2009-06-06 19:00:00 Actual result: -------------- 2009-06-06 17:00:00 object(Date)#1 (9) { ["year"]=> int(2009) ["month"]=> int(6) ["day"]=> int(6) ["hour"]=> int(17) ["minute"]=> int(0) ["second"]=> int(0) ["partsecond"]=> float(0) ["tz"]=> object(Date_TimeZone)#3 (8) { ["id"]=> string(3) "UTC" ["longname"]=> string(26) "Coordinated Universal Time" ["shortname"]=> string(3) "UTC" ["hasdst"]=> bool(false) ["dstlongname"]=> string(26) "Coordinated Universal Time" ["dstshortname"]=> string(3) "UTC" ["offset"]=> int(0) ["default"]=> NULL } ["getWeekdayAbbrnameLength"]=> int(3) }

Comments