Magento is saving datetime in a wrong format. In form I'm using

$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('start_time', 'date', array(
        'name'   => 'start_time',
        'label'  => Mage::helper('cms')->__('Start Date'),
        'title'  => Mage::helper('cms')->__('Start Date'),
        'image'  => $this->getSkinUrl('images/grid-cal.gif'),
        'input_format' => $dateFormatIso,
        'format'       => $dateFormatIso,
        'time' => true

instead of "day month year" it saving it as "month day year" of course settings in Magento are correct. Why it is doing it ? Can't find reason. How can I change date format in form ? I've changed 'input_format' and 'format' to Varien_Date::DATE_INTERNAL_FORMAT, but now it gives me 2018-02-05 and can't select time instead but date/time saved is 05-02-2018 00:00 while I would like to have an option to change time as well or even set it for start date to 00:00:00 and for end date 23:59:59 to cover whole day. How can I achieve it ?

1 Answer 1


Try using Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) instead of Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);

  • Thank you Chester, unfortunately it does not changed anything ;( Whether it is Date or DateTime still changing format to "American" MonthDayYear which is driving me crazy.
    – Rob D. A.
    Feb 5, 2018 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.