php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72398 DST issue
Submitted: 2016-06-13 19:48 UTC Modified: 2017-03-19 12:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: matthieuxdekamen at gmail dot com Assigned: derick (profile)
Status: Duplicate Package: Date/time related
PHP Version: 7.1.0alpha1 OS:
Private report: No CVE-ID: None
 [2016-06-13 19:48 UTC] matthieuxdekamen at gmail dot com
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-14 05:32 UTC] krakjoe@php.net
-Assigned To: +Assigned To: derick
 [2017-03-19 12:00 UTC] heiglandreas@php.net
-Status: Assigned +Status: Duplicate
 [2017-03-19 12:00 UTC] heiglandreas@php.net
We're now tracking this in https://bugs.php.net/bug.php?id=74274
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jan 19 05:01:23 2020 UTC