Google+

Pages

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,
));

4 comments:

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...

Hi

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