Details
Description
On my system PHP's date() function can handle dates roughly between the dates 1901 to 2038. Zend_Date also works fine inside this same range but when a date is outside this range the returned unix timestamp produced by calling get(Zend_Date::TIMESTAMP) had the timezone offset added to the timestamp, which is wrong. Code to prove this:
date_default_timezone_set('EET');
//December 6th 1917 10:10:10
$timestamp = '-1643212190';
$dateObj = new Zend_Date($timestamp);
echo $timestamp . "\n";
echo $dateObj->getTimestamp() . "\n";
echo $dateObj->get(Zend_Date::TIMESTAMP) . "\n";
//December 6th 1817 10:10:10
$timestamp = '-4798885790';
$dateObj = new Zend_Date($timestamp);
echo $timestamp . "\n";
echo $dateObj->getTimestamp() . "\n";
echo $dateObj->get(Zend_Date::TIMESTAMP);
This produces the output:
-1643212190 -1643212190 -1643212190 -4798885790 -4798885790 -4798878590
Why is the last unix timestamp not the same when calling get(Zend_Date::TIMESTAMP) and calling getTimestamp() when the date is outside the year range of 1901 to 2038? Dates inside this year range get correctly the same unix timestamp from both methods.
Issue Links
| This issue duplicates: | ||||
| ZF-7731 | Zend_Date_DateObject::date returns timestamp with added timezone offset when timestamp is outside the range of what PHP's date() can handle |
|
|
|
Duplicate of already fixed issue.