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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 26 20:01:29 2024 UTC