I have just run into this issue.
By placing a test magento order, and confirming the datetime placed for the created_at value of that order, I have managed to establish the following:
The date from the form field (thus date picker attached to that field) is not being converted to/from UTC when loading / saving on the db.
The display in the grid is correctly converting from UTC to the sites locale timezone.
Example: I place my order at 08:22 am (AWST) - the entry saved in created at was 00:22 (-8h UTC from AWST)
When that order is viewed in the grid, it is correctly shown as 08:22 AM again (AWST)
Now, If I place a date time in the date-picker (or just manually type it into the form field) (so again using 08:22 AM), the value stored into the DB is exactly that 08:22 - where it should have been 00:22 - so, it is not converted to UTC upon save.
If I do convert it to UTC before save:
$data['date_time'] = Mage::getModel('core/date')->gmtDate("Y-m-d H:i:s", $data['date_time']);
it is correctly save to UTC in db, and the grid view then correctly displays 08:22 AM (correctly converted from UTC to AWST)
However, if I view that in the form edit, it simply displays the value AS IS from the db - so as 00:22 - so no conversion was done from UTC to AWST (which is part of the issue)
To make this work for me, I had to:
Create a new form element:
$form->addType('datetimezone', 'Enjo_Events_Lib_Data_Form_Element_Datetime');
created the element as such:
$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$form->addField('date_time', 'datetimezone', array(
'name' => 'date_time',
'label' => Mage::helper('enjo_events')->__('Date and Time'),
'title' => Mage::helper('enjo_events')->__('Date and Time'),
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
'format' => $dateFormatIso,
'time' => true,
'class' => 'required-entry',
'required' => true,
'width' => "150",
'locale' => Mage::getStoreConfig('general/locale/code', 0),
'convert_date_format' => "d/m/Y h:m a"
));
and the new form element code:
class Enjo_Events_Lib_Data_Form_Element_Datetime extends Varien_Data_Form_Element_Datetime
{
/**
* Get date value as string.
* Format can be specified, or it will be taken from $this->getFormat()
*
* @param string $format (compatible with Zend_Date)
* @return string
*/
public function getValue($format = null)
{
if (empty($this->_value)) {
return '';
}
if (null === $format) {
$format = $this->getFormat();
}
return Mage::getModel('core/date')->date($this->getConvertDateFormat(), $this->_value);
}
}
and on the controller action, convert the date to UTC before saved.
$data = $this->getRequest()->getParams();
$data = $this->_filterDateTime($data, array('date_time'));
$data['date_time'] = Mage::getModel('core/date')->gmtDate("Y-m-d H:i:s", $data['date_time']);
$event->addData($data)->save();
which resulted in the correct data: UTC in DB, my store lcoale/zone in edits / views of said data.
I am not 100% sure where the failing is, so I class this as a workaround.