php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69806 Incorrect date from timestamp
Submitted: 2015-06-12 01:37 UTC Modified: 2021-04-06 19:53 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: ryan dot brothers at gmail dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.6.10 OS: Linux
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: ryan dot brothers at gmail dot com
New email:
PHP Version: OS:

 

 [2015-06-12 01:37 UTC] ryan dot brothers at gmail dot com
Description:
------------
I am seeing an issue where PHP's date() function is returning a different date/time compared to the linux date command for certain dates.  In the below example, I was expecting the 2 dates to be the same.  It possibly looks to be related to Daylight Saving Time not being included by the date() function for this date.


Test script:
---------------
<?php
ini_set('date.timezone', 'America/New_York');

echo date('Y-m-d H:i:s', 2377224000)."\n";

echo `TZ=America/New_York date --date='@2377224000' "+%Y-%m-%d %H:%M:%S"`."\n";

exit;


Expected result:
----------------
2045-05-01 00:00:00
2045-05-01 00:00:00


Actual result:
--------------
2045-04-30 23:00:00
2045-05-01 00:00:00


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-06 19:53 UTC] derick@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: derick
 [2021-04-06 19:53 UTC] derick@php.net
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.

Fixed for PHP 8.1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC