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: -
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:
Status: Open Package: Date/time related
PHP Version: 5.6.10 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 04:01:23 2020 UTC