0

Here is my code :

$not_allowed_date=$fieldset->addField('not_allowed_date', 'date', array(
        'name'      => 'not_allowed_date',
        'label'     => Mage::helper('po')->__('Not Allowed Date'),
        'required'  => true,
        'image'  => $this->getSkinUrl('images/grid-cal.gif'),
        'format' => 'dd-MM-yyyy',
        'note' => "dd-mm-yyyy",
        'time' => true
    ));

enter image description here

1

You have to set date format as per your current locale

$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
        $fieldset->addField('not_allowed_date', 'date', array(
            'name'   => 'not_allowed_date',
            'label'  => Mage::helper('po')->__('Not Allowed Date'),
            'title'  => Mage::helper('po')->__('Not Allowed Date'),
            'image'  => $this->getSkinUrl('images/grid-cal.gif'),
            'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
            'value' => date('d/m/Y'),
            'format'       => $dateFormatIso
        ));
1
  • this code is not work in my grid module. My Problem is not solve. I am new in magento. Jul 1 '16 at 5:13
1

To Display Current Date in date picker you need to set date in value parameter

    $fieldset->addField('not_allowed_date', 'date', array(
               'name'      => 'not_allowed_date',
               'label'     => Mage::helper('catalog')->__('Not Allowed Date'),
               'required'  => true,
               'image'  => $this->getSkinUrl('images/grid-cal.gif'),
               'format' => 'dd-MM-yyyy',
               'note' => "dd-mm-yyyy",
               'time' => true ,
               'value' => date('d/m/Y')
               )
   );
5
  • this code is not work in my grid module. My Problem is not solve. I am new in magento. Jul 1 '16 at 5:12
  • well you have added screen shot of form not grid Jul 1 '16 at 5:16
  • clear your magento cache. it should work in form Jul 1 '16 at 5:17
  • Hello sir, I want to show current date when select drop down list in "Not Allowed" options. But it show 30-11-2000. Please solve my Problem. Thanks Jul 1 '16 at 5:23
  • I have clear all catch in magento but not work. Jul 1 '16 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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