I have added the date field in the custom form using below code :
// Added start date field
$fieldset->addField('start_date', 'date', array(
'label' => Mage::helper('slider')->__('Start Date'),
'required' => false,
'class' => 'validate-date validate-date-range date-range-attribute-from',
'name' => 'start_date',
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
'format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
'time' => true
));
// Added end date field
$fieldset->addField('end_date', 'date', array(
'label' => Mage::helper('slider')->__('End Date'),
'required' => false,
'class' => 'validate-date validate-date-range date-range-attribute-to',
'name' => 'end_date',
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
'format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
'time' => true
));
And use below code to add date fields in data array at the time of saving
$data = $this->_filterDateTime($data, array('start_date', 'end_date'));
Now suppose I am choosing 09/30/2016 08:08 AM
as end date
After saving the form, Magento is showing 9/30/2016 12:00 AM
in the field.
Whereas in the database table the end_date entry is correct i.e. 2016-09-30 08:08:00
What can be the issue here and how it can be fixed?
Any help would be appreciated.