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,
));
‘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,
));
8 comments:
It was a good blog and useful. share more updates. Web Design Company Bangalore | Web Design Bangalore
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
Thanks for sharing the best solution.
Magento Company uk magento Developer uk
Very informative blog thanks for sharing the information about Magento.
Your post has many detail information. magento development company uk I read all your post and I really like it. Thank you for sharing this great post.
i dont know people always choose www.desss.com for online business building website and hosting @ afffordable price
Thank you for sharing your info. I really appreciate your efforts and I will be waiting for your next
Mobile app development Company
Post a Comment