-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 MySQL works fine with the ISO timestamp.
Mark Murphy wrote on 17.01.2010 21:40: > But there has to be an easier way to set the format than having to write > a helper. Is there something with Zend_Locale, or something like that? > > Maxence Delannoy wrote: >> You can write a custom view helper which take a date in YYYY-MM-DD >> format but display it with another format like MM/DD/YYYY : >> >> class Wiip_Date extends Zend_Date >> { >> const MYSQL_DATE = 'yyyy-MM-dd'; >> const MYSQL_DATETIME = 'yyyy-MM-dd HH:mm:ss'; >> } >> >> class Wiip_View_Helper_FormDate extends Zend_View_Helper_FormText >> { >> public function formDate($name, $value = '', $attribs = null) >> { >> if (!isset($attribs)) $attribs = array(); >> >> (isset($attribs['class'])) ? $attribs['class'] .= ' date' : >> $attribs['class'] = 'date'; >> if (!isset($attribs['maxlength'])) $attribs['maxlength'] = >> strlen(Zend_Date::DATE_SHORT); >> if (!isset($attribs['size'])) $attribs['size'] = >> strlen(Zend_Date::DATE_SHORT); >> >> if (Zend_Date::isDate($value, Wiip_Date::MYSQL_DATE)) { >> $date = new Zend_Date($value, Wiip_Date::MYSQL_DATE); >> $value = $date->get(Zend_Date::DATE_SHORT); >> } elseif ($value == '0000-00-00') { >> $value = ''; >> } >> return parent::formText($name, $value, $attribs); >> } >> } >> >> __________ Information from ESET NOD32 Antivirus, version of virus >> signature database 4778 (20100116) __________ >> >> The message was checked by ESET NOD32 Antivirus. >> >> http://www.eset.com >> >> >> >> >> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAktTtvsACgkQ0HfT5Ws789AYHgCdF/sR36fXR+dXqzNLmi8tHzFt KDwAn0eer+qO4crxrYWK0yQ3PCz2PIrX =Jju0 -----END PGP SIGNATURE-----