Bug #75975 [NEW]: strftime prints current timezone instead of historical
| From: | anton at zebooka dot com | Date: | Sat, 17 Feb 2018 05:56:55 +0000 |
| Subject: | Bug #75975 [NEW]: strftime prints current timezone instead of historical | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213999@lists.php.net to get a copy of this message | ||
From: anton at zebooka dot com
Operating system: macOS 10.13.3
PHP version: 7.1.14
Package: Date/time related
Bug Type: Bug
Bug description:strftime prints current timezone instead of historical
Description:
------------
This function outputs incorrect timezone.
Instead of outputting historical timezone for specified timestamp, it
outputs current one.
TZ = Asia/Novosibirsk
We have changed timezone several times in Russia, Novosibirsk.
We dropped DST in 26 of March 2011 and added +1 hour permanently to TZ.
Then in 2014 government decided to move back to "winter time" and -1
hour from timezones. Then in summer 2016 local goverments of several
states moved back to "summer time" and added +1 hour.
$ zdump -v /usr/share/zoneinfo/Asia/Novosibirsk | tail -n10
/usr/share/zoneinfo/Asia/Novosibirsk Sat Oct 30 19:59:59 2010 UTC = Sun
Oct 31 02:59:59 2010 +07 isdst=1
/usr/share/zoneinfo/Asia/Novosibirsk Sat Oct 30 20:00:00 2010 UTC = Sun
Oct 31 02:00:00 2010 +06 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Sat Mar 26 19:59:59 2011 UTC = Sun
Mar 27 01:59:59 2011 +06 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Sat Mar 26 20:00:00 2011 UTC = Sun
Mar 27 03:00:00 2011 +07 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Sat Oct 25 18:59:59 2014 UTC = Sun
Oct 26 01:59:59 2014 +07 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Sat Oct 25 19:00:00 2014 UTC = Sun
Oct 26 01:00:00 2014 +06 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Sat Jul 23 19:59:59 2016 UTC = Sun
Jul 24 01:59:59 2016 +06 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Sat Jul 23 20:00:00 2016 UTC = Sun
Jul 24 03:00:00 2016 +07 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Mon Jan 18 03:14:07 2038 UTC = Mon
Jan 18 10:14:07 2038 +07 isdst=0
/usr/share/zoneinfo/Asia/Novosibirsk Tue Jan 19 03:14:07 2038 UTC = Tue
Jan 19 10:14:07 2038 +07 isdst=0
strftime() output current +0700 TZ for historical date in 2015 year,
although date() function returns correct TZ +0600.
Incorrect:
php > echo strftime('%Y-%m-%d %H:%M:%S %z', strtotime("2015-11-15"));
2015-11-15 00:00:00 +0700
Correct:
php > echo date('Y-m-d H:i:s O', strtotime("2015-11-15"));
2015-11-15 00:00:00 +0600
Test script:
---------------
echo strftime('%Y-%m-%d %H:%M:%S %z', strtotime("2015-11-15"));
Expected result:
----------------
2015-11-15 00:00:00 +0600
Actual result:
--------------
2015-11-15 00:00:00 +0700
--
Edit bug report at https://bugs.php.net/bug.php?id=75975&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75975&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75975&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75975&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75975&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75975&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75975&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75975&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75975&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75975&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75975&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75975&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75975&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75975&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75975&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75975&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75975&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75975&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75975&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75975&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75975&r=mysqlcfg