Details
Description
Zend_Date is returning the wrong date when creating a new object with no parameters.
Example:
$logDate = new Zend_Date($dateStr, "YYYY-MM-DD HH:mm");
$curDate = new Zend_Date();
echo "Log: $logDate\n";
echo "Cur: " . $curDate . "\n";
echo "Time: " . gmdate("Y-m-d\\TH:i:s.000
Z", time()) . "\n";
I get the following output:
Log: Oct 9, 2008 2:28:00 PM
Cur: Dec 31, 1969 7:28:05 PM
Time: 2008-10-09T18:56:05.000Z
So Zend_Date() is returning a 1969 date, while time() is returning the correct date. Zend_Date's documentation claims that it uses the time() function to get the correct date, so the issue must lie within Zend_Date. The wierd thing is that Zend_Date works for the first call, when it is assigned into $logDate, it is only after the second call when it is assigned into $curDate that it gives the incorrect date.
It does...
see line 184, 185, 3367
You are the only one who has such a problem since 2 years.
So it must be eighter a php version problem or a environment problem.
So try the following:
print time(); $date = new Zend_Date(); print $date->getIso(); print $date->getTimestamp(); $date = Zend_Date::now(); print $date->getIso(); $date = Zend_Date(time()); print $date->getIso(); $date = Zend_Date(200000); print $date->getIso(); $date = Zend_Date('20.March.2008', 'en'); print $date->getIso();Additionally give your ZF version, your PHP version, your environment, your locale.
print time(); $date = new Zend_Date(); print $date->getIso(); print $date->getTimestamp(); $date = Zend_Date::now(); print $date->getIso(); $date = Zend_Date(time()); print $date->getIso(); $date = Zend_Date(200000); print $date->getIso(); $date = Zend_Date('20.March.2008', 'en'); print $date->getIso();