Engine23
blogBannerImage
By Engine23

Adding time to the Magento adminhtml Form

Have you ever wanted to know how to put a time on the adminhtml Form.php

               $dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(
            Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
        );

        $fieldset->addField('date_start', 'date', array(
            'label'        => Mage::helper('enterprise_catalogevent')->__('Start Date'),
            'name'         => 'date_start',
            'required'     => true, 
            'time' => true,
            'image'        => $this->getSkinUrl('images/grid-cal.gif'),
            'format'       => $dateFormatIso
        ));

The magic is the 'time' line. By adding , 'time' => true, it puts the time at the bottom of the calendar.

Feel free to checkout our Magento support if you would like some help with this.