Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Magento 1.6:Verwenden von MySQL-Datumszeitfeldern mit Ressourcenmodellen

Sie können es in Ihrem Ressourcenmodell handhaben, etwa so:

protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
    ...
    $date = $object->getReleaseDate();
    // convert from your server/client timezone to UTC if needed
    $object->setReleaseDate($this->formatDate($date));
    ...
}

protected function _afterLoad(Mage_Core_Model_Abstract $object)
{
    ...
    $date = new Zend_Date($object->getReleaseDate());
    // convert to your server/client timezone from UTC if needed
    $object->setReleaseDate($date);
    ...
}