Monday, July 4, 2016

How to add a datetime picker input field in admin module form in magento 1.x

To add a date/time input field in admin form in magento 1.x, you need to simply use code like below:

$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField(‘time_from’, ‘date’, array(
‘name’ => ‘time_from’,
‘class’ => ‘required-entry’,
‘required’ => true,
‘label’ => Mage::helper(‘event’)->__(‘Time From’),
‘image’ => $this->getSkinUrl(‘images/grid-cal.gif’),
‘input_format’ => Varien_Date::DATETIME_INTERNAL_FORMAT,
‘format’ => $dateFormatIso,
‘time’ => true, //if you don’t want time, then simply set ‘time’ => false,


Zinavo Bangalore said...

It was a good blog and useful. share more updates. Web Design Company Bangalore | Web Design Bangalore

Ashish Khadpe said...
This comment has been removed by the author.
Ashish Khadpe said...


Thank you for your solution. It did not worked for me,
May be you can try solution given at Magento Coders

Visit Us : Magento Ecommerce Development India | Parsys Media

Azhar Nisar said...

For best and cheap manual Seo services, Web designings. Must check Web Design Bangalore

Alex Wood said...

Thanks for sharing the best solution.
Magento Company uk magento Developer uk

Megan Leah said...

Thanks a lot for that information. magento ecommerce development uk That was a really Intresting post and I would really like to know more.