Bug #72398 [NEW]: DST issue
From: matthieuxdekamen at gmail dot com
Operating system:
PHP version: 7.1.0alpha1
Package: Date/time related
Bug Type: Bug
Bug description:DST issue
Description:
------------
In Netherland's timezone (GMT+1/+2), if I add 23 hours to 29 October
2016 10 o'clock, I get 30 October 8 o'clock because we moved the clock 1
hour backwards.
But when I add 23 hours to 26 March 2016 10 o'clock, why don't I get 10
o'clock as we moved the clock one hour forward? Instead, I obtain 9
o'clock (as no DST change occured).
See here:
https://3v4l.org/uXf8d
Test script:
---------------
echo date_default_timezone_get(); // prints Europe/Amsterdam
echo "\n\n";
$dateTime = new DateTime('2016-10-29 10:00:00'); // back one hour
echo $dateTime->format(DateTime::RFC3339);
echo "\n";
$dateTime->add(new DateInterval('PT23H'));
echo $dateTime->format(DateTime::RFC3339); // prints
2016-10-30T08:00:00+01:00
echo "\n\n";
$dateTime = new DateTime('2016-03-26 10:00:00'); // forward one hour
echo $dateTime->format(DateTime::RFC3339);
echo "\n";
$dateTime->add(new DateInterval('PT23H'));
echo $dateTime->format(DateTime::RFC3339); // prints
2016-03-27T09:00:00+02:00 (expected 10 o'clock)
echo "\n\n";
$dateTime = new DateTime('2016-05-26 10:00:00'); // no DST change
echo $dateTime->format(DateTime::RFC3339);
echo "\n";
$dateTime->add(new DateInterval('PT23H'));
echo $dateTime->format(DateTime::RFC3339); // prints
2016-05-27T09:00:00+02:00
--
Edit bug report at https://bugs.php.net/bug.php?id=72398&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72398&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72398&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72398&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72398&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72398&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72398&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72398&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72398&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72398&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72398&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72398&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72398&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72398&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72398&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72398&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72398&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72398&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72398&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72398&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72398&r=mysqlcfg
Thread (2 messages)
- matthieuxdekamen at gmail dot com