Bug #72470 [NEW]: modify() doesn't take into account DST changes
| From: | matthieux dot dekamen at gmail dot com | Date: | Wed, 22 Jun 2016 19:58:35 +0000 |
| Subject: | Bug #72470 [NEW]: modify() doesn't take into account DST changes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201802@lists.php.net to get a copy of this message | ||
From: matthieux dot dekamen at gmail dot com
Operating system:
PHP version: 7.1.0alpha1
Package: Date/time related
Bug Type: Bug
Bug description:modify() doesn't take into account DST changes
Description:
------------
modify() doesn't take into account DST changes.
For example, if I add 23 hours with DateInterval where a DST change
occurs:
echo date_default_timezone_get(); // prints Europe/Amsterdam
$dateTime = new DateTime('2016-10-29 10:00:00');
$dateTime->add(new DateInterval('PT23H'));
I get the expected result: 2016-10-30T08:00:00+01:00 (clock went
backwards for 1 hour)
But if I add 23 hours with the modify() function on the same date:
$dateTime = new DateTime('2016-10-29 10:00:00');
$dateTime->modify('+ 23 hours');
I get: 2016-10-30T09:00:00+01:00
As you see the result here is different. modify() seems to not take into
account DST changes.
https://3v4l.org/4fncr
--
Edit bug report at https://bugs.php.net/bug.php?id=72470&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72470&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72470&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72470&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72470&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72470&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72470&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72470&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72470&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72470&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72470&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72470&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72470&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72470&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72470&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72470&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72470&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72470&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72470&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72470&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72470&r=mysqlcfg