There are 2 column types:
// lib\Varien\Db\Ddl\Table.php
const TYPE_TIMESTAMP = 'timestamp'; // Capable to support date-time from 1970 + auto-triggers in some RDBMS
const TYPE_DATETIME = 'datetime'; // Capable to support long date-time before 1970
All columns are of type Varien_Db_Ddl_Table::TYPE_TIMESTAMP
in OpenMage, except for customer_dob
and columns in eav datetime tables, which are of type Varien_Db_Ddl_Table::TYPE_DATETIME
.
MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.)
To set the datetime values for each type:
// TYPE_TIMESTAMP
$model->setData('created_at', Varien_Date::now());
// TYPE_DATETIME, set current local datetime
$model->setData('visited_at', Mage::getSingleton('core/date')->timestamp());
// TYPE_DATETIME, set local datetime
$model->setData('visited_at', '2021-03-24 13:21:00');
Posted by kiatng to OpenMage (2021-03-24 02:47)