1

I want to add date picker in admin form which display 24 hour format. Currently , I select date then it will display like 4/25/17 5:21 PM

But I want to display like this 2017-04-25 17:21:00

How to do it?

Please help me....

Thanks in advance.... :)

$fieldset->addField(
        'from_date',
        'date',
        [
             'name' => 'from_date',
            'label' => __('From'),
            'title' => __('From'),
            /*'date_format' => 'yyyy-MM-dd',
            'time_format' => 'hh:mm:ss'*/
            'date_format' => $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT),
            'time_format' => $this->_localeDate->getTimeFormat(\IntlDateFormatter::SHORT),
        ]

    );

1 Answer 1

4

Change it to:

'date_format' => \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT,
'time_format' => 'HH:mm:ss',

Hope it helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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