Bug #67129 [Com]: DateTimeZone incorrect offset for MDT

From: Date: Sat, 17 Aug 2019 20:55:58 +0000
Subject: Bug #67129 [Com]: DateTimeZone incorrect offset for MDT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222300@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67129&edit=1 ID: 67129 Comment by: 2 dot josh dot schmidt at gmail dot com Reported by: rmeyenburg at gmail dot com Summary: DateTimeZone incorrect offset for MDT Status: Open Type: Bug Package: *General Issues Operating System: Win7x64 (32bit PHP) PHP Version: 5.5.11 Block user comment: N Private report: N New Comment: MDT still has a -7 offset when it should be -6. It's correct in versions of php before 5.5.10 and all versions of HHVM. https://3v4l.org/M7YiI Previous Comments: ------------------------------------------------------------------------ [2014-09-19 14:08:57] martin dot keckeis1 at gmail dot com I think the problem is related to here: http://en.wikipedia.org/wiki/Year_2038_problem Since PHP is still build for x86... Can you try the x64 build? http://windows.php.net/download/ ------------------------------------------------------------------------ [2014-06-26 14:36:26] sly at diglin dot com I have also a similar error with date which are after the year 2037. I use a timezone 'Europe/Berlin' PHP 5.5.7 (cli) (built: Jan 28 2014 02:32:47) Zend Server 6 OS: OS X 10.9.3 Test Script: <?php $zone = new \DateTimeZone("Europe/Berlin"); $o1=$zone->getOffset(new \DateTime("2079-06-06 23:59:00",$zone))/3600; $o2=$zone->getOffset(new \DateTime("2038-06-06 23:59:00",$zone))/3600; $o3=$zone->getOffset(new \DateTime("2037-06-06 23:59:00",$zone))/3600; $o4=$zone->getOffset(new \DateTime("2014-06-06 23:59:00",$zone))/3600; echo "2079-06-06 23:59:00: ".($o1==2?"Pass":"Fail ($o1)")."\n"; echo "2038-06-06 23:59:00: ".($o2==2?"Pass":"Fail ($o2)")."\n"; echo "2037-06-06 23:59:00: ".($o3==2?"Pass":"Fail ($o3)")."\n"; echo "2014-06-06 23:59:00: ".($o4==2?"Pass":"Fail ($o4)")."\n"; Expected result: ---------------- 2079-06-06 23:59:00: Pass 2038-06-06 23:59:00: Pass 2037-06-06 23:59:00: Pass 2014-06-06 23:59:00: Pass Actual Result: ---------------- 2079-06-06 23:59:00: Fail (1) 2038-06-06 23:59:00: Fail (1) 2037-06-06 23:59:00: Pass 2014-06-06 23:59:00: Pass ------------------------------------------------------------------------ [2014-04-24 18:28:19] rmeyenburg at gmail dot com Description: ------------ --- From manual page: http://www.php.net/datetimezone.getoffset --- MDT (Mountain Daylight Time) is defined as UTC-6, while the PHP DateTimeZone object reports the offset as UTC-7 (same as MST/Mountain Standard Time). Two tests are performed to check that day of the year (in or out of daylight saving's time) isn't effecting the result - MDT is always UTC-6 regardless of time of year (since UTC doesn't move) Tested on PHP 5.5.11, 5.4.26, 5.3.28 NOTE: 5.5 differs from 5.4, 5.3 Untested (although perhaps implied) other Daylight time zones (PDT,CDT,EDT,ADT,NDT) Test script: --------------- <?php $zone=new \DateTimeZone("MDT"); $o1=$zone->getOffset(new \DateTime("2012-01-01",$zone))/3600; $o2=$zone->getOffset(new \DateTime("2012-08-01",$zone))/3600; echo "2012-01-01: ".($o1==-6?"Pass":"Fail ($o1)")."\n"; echo "2012-08-01: ".($o2==-6?"Pass":"Fail ($o2)")."\n"; Expected result: ---------------- 2012-01-01: Pass 2012-08-01: Pass Actual result: -------------- // 5.5.11-Win32-VC11-x86 2012-01-01: Fail (-7) 2012-08-01: Fail (-7) // 5.4.26-Win32-VC9-x86 2012-01-01: Fail (-7) 2012-08-01: Pass // 5.3.28-Win32-VC9-x86 2012-01-01: Fail (-7) 2012-08-01: Pass ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67129&edit=1

« previous php.bugs (#222300) next »