Hy,
I've been trying to use zend_date to rearrange mysql dates and am having
problems.
when i try the examples from the manual
$date = new Zend_Date();
print $date;
or
$date = new Zend_Date();
print $date->get();
This works only with the new branch...
Within the cored Zend_Date you must do the following:
$date = Zend_Date::now();
or
$date = new Zend_Date(time());
This will change for 0.8 to the behaviour you mentioned... you can get the
branch I18N-pre0.8 to see the new behaviour.
Second:
If you want a mysql output you should do:
$date->get(Zend_Date::ISO_8601);
or generate your own output :
$date->toString('yyyy-MM-ddTHH:mm:ss');
$date = new Zend_Date($myDate, Zend_Date::ISO_8601);
$date->toString('dd.MM.yyyy HH:mm:ss');
when i try this i get the date that is stored in the mysql but the
toString() as no effect on the output. Changing any of the MM.yyyy does
not change the output.
All I want to do is change 2007-01-31 to 01-31-2007.
$date->toString('MM-dd-yyyy');
is what you want if you have to store the above format.
For user output I would do output like the user suspects it.
$userslocale = new Zend_Locale();
$date->toString(Zend_Date::DATES, $userslocale);
Greetings
Thomas
(I18N Team Leader)
Btw: Further mails should be done to the I18N Mailing list...