php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53370 Some relative date/time format returns incorrect result at the end of DST
Submitted: 2010-11-21 13:38 UTC Modified: 2011-11-21 03:04 UTC
From: for-bugs at hnw dot jp Assigned: danielc (profile)
Status: Duplicate Package: Date/time related
PHP Version: 5.3.3 OS: Linux and MacOSX
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: for-bugs at hnw dot jp
New email:
PHP Version: OS:

 

 [2010-11-21 13:38 UTC] for-bugs at hnw dot jp
Description:
------------
Relative date/time format '+[number]sec', '+[number]min', '+[number]hour' returns incorrect time when the current time is in daylight saving time and the result of calculation is non-daylight saving time.

For example, daylight saving time of this year in the USA was started at 2010-03-14 02:00:00, and finished at 2010-11-07 02:00:00. However, '2010-11-07 01:59:59 +1sec' advance to 3601 sec after.

Test script:
---------------
<?php
date_default_timezone_set('America/Los_Angeles');
echo date("c", strtotime("2010-03-14 01:59:59")) . PHP_EOL;
echo date("c", strtotime("2010-03-14 01:59:59 +1sec")) . PHP_EOL;
echo date("c", strtotime("2010-11-07 01:59:59")) . PHP_EOL;
echo date("c", strtotime("2010-11-07 01:59:59 +1sec")) . PHP_EOL;


Expected result:
----------------
2010-03-14T01:59:59-08:00
2010-03-14T03:00:00-07:00
2010-11-07T01:59:59-07:00
2010-11-07T01:00:00-08:00

Actual result:
--------------
2010-03-14T01:59:59-08:00
2010-03-14T03:00:00-07:00
2010-11-07T01:59:59-07:00
2010-11-07T02:00:00-08:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-21 03:04 UTC] danielc@php.net
This is a duplicate of https://bugs.php.net/bug.php?id=51051
 [2011-11-21 03:04 UTC] danielc@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: danielc
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC