Bug #68549 [NEW]: Timezones and offsets are not properly used when working with dates
From: mfaust at usinternet dot com
Operating system: Linux
PHP version: 5.6.3
Package: Date/time related
Bug Type: Bug
Bug description:Timezones and offsets are not properly used when working with dates
Description:
------------
Unix timestamps are not respected during daylight savings transitions.
When specifying a timestamp during a repeated hour, DateTime
silently(incorrectly) modifies the timestamp to the previous hour.
In regards to the proposed
https://wiki.php.net/rfc/datetime_and_daylight_saving_time
change, there
are some current behaviors in regards to the "fall back" repeated hour
that sorely need to be addressed. For those that understand and need
proper and accurate date/time handling it is crucial that these
inconsistent behaviors are eliminated.
Test script:
---------------
//A timestamp indicates a fixed point in time, irregardless of timezone
and daylight savings, so PHP must not change it when setting it:
$x = new DateTime();
$x->setTimezone(new DateTimezone('America/Chicago'));
$x->setTimestamp(1446357600);
echo $x->format('c') . "\n";
$x->setTimestamp(1446361200);
echo $x->format('c') . "\n"; //This should have a different offset since
it's outside DST
echo $x->getTimestamp();
//Simpler example
$x = new DateTime();
$x->setTimezone(new DateTimezone('America/Chicago'));
$x->setTimestamp(1446361200);
echo $x->getTimestamp(); //Returns a different timestamp. No apparent
way to specify a timestamp during the repeated hour.
--
Edit bug report at https://bugs.php.net/bug.php?id=68549&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68549&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68549&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68549&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68549&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68549&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68549&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68549&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68549&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68549&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68549&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68549&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68549&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68549&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68549&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68549&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68549&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68549&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68549&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68549&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68549&r=mysqlcfg
Thread (12 messages)
- mfaust at usinternet dot com
- yohgaki@php.netBug #68549 [Opn]: Timezones and offsets are not properly used when working with dates
- bestcoder at ymail dot comBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- mj1856 at hotmail dot comBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- roel dot harbers at on2it dot netBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- heiglandreas@php.netBug #68549 [Opn]: Timezones and offsets are not properly used when working with dates
- roel dot harbers at on2it dot netBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- heiglandreas@php.netBug #68549 [Opn]: Timezones and offsets are not properly used when working with dates
- roel dot harbers at on2it dot netBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- roel dot harbers at on2it dot netBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- roel dot harbers at on2it dot netBug #68549 [Com]: Timezones and offsets are not properly used when working with dates
- git@php.netBug #68549 [Opn->Csd]: Timezones and offsets are not properly used when working with dates