Problem with Zend_Date and ISO_8601 format
Posted
by Noah Goodrich
on Stack Overflow
See other posts from Stack Overflow
or by Noah Goodrich
Published on 2009-11-06T11:18:20Z
Indexed on
2010/04/14
20:43 UTC
Read the original article
Hit count: 376
Frankly, I'm flummoxed. Can anyone tell me why I would get a failure message with this code?
$date = Zend_Date::now();
$date = $date->getIso();
if(Zend_Date::isDate($date, Zend_Date::ISO_8601)) {
print('success');
} else {
print('failure');
}
exit;
It also fails if I just pass in a Zend_Date object.
UPDATE:
a var_dump of the initial $date object looks like this:
object(Zend_Date)#107 (8) { ["_locale:private"]=> string(5) "en_US" ["_fractional:private"]=> int(0) ["_precision:private"]=> int(3) ["_unixTimestamp:private"]=> int(1257508100) ["_timezone:private"]=> string(14) "America/Denver" ["_offset:private"]=> int(25200) ["_syncronised:private"]=> int(0) ["_dst:protected"]=> bool(true) }
And a var_dump of the $date string after calling $date->getIso() looks like this:
string(25) "2009-11-06T04:48:20-07:00"
I am using ZF 1.9.5 on PHP 5.2.8. I am using XAMPP for Windows too if that makes a difference.
© Stack Overflow or respective owner