Thomas -
It would certainly make sense to add an interface/constant to aid in
getting a MySQL compatible string. Seems like one of the more, if not
the most, common output usages.
Dale
Thomas Weidner wrote:
Hy,
you are wrong...
The manual does not state that getIso() creates MySql Syntax.
It is written that you can use all ISO formats as input for Zend_Date.
As there are over 50 different ISO formats it would be nonsense to
define as much constants.
But creating an non-standard Zend_Date output is also very easy...
Instead of getIso() just use
toString('YYYY-MM-dd HH:mm:ss');
and you have your self defined output.
Greetings
Thomas
I18N Team Leader
----- Original Message ----- From: "Jack Sleight"
<[EMAIL PROTECTED]>
To: "Zend Framework General" <[email protected]>
Sent: Thursday, September 20, 2007 7:38 PM
Subject: [fw-general] Zend_Date and MySQL datetime
Hi,
The ZF manual states that for MySQL datetime values you can use the
Zend_Date::ISO_8601 format, and the $date->getIso() method. It is
true that if you parse in a date from a MySQL field with the ISO 8601
format constant it will work, but strictly speaking they are not
(correctly) ISO 8601 formatted. This becomes a problem when trying to
save a date into the database, because the value returned by
$date->getIso() is not accepted by MySQL, and it throws an error
(Incorrect datetime value: '2007-09-20T18:36:59+01:00'). The correct
format for a MySQL datetime string is "YYYY-MM-dd HH:mm:ss".
Could we add this as a new constant in Zend_Date?
--
Jack
--
------------------------------------------------------------------------
Dale McNeill |
Alchemy Systems | phone: (512) 532-8050
http://www.alchemysystems.com | email: [EMAIL PROTECTED]
------------------------------------------------------------------------