3

How can I get datetime as form field.I have used below code able to select date but there is no time. How can I get time also as input field.

$fieldset->addField(
            'time',
            'date',
            [
                'name' => 'time',
                'label' => __('Time'),
                'title' => __('Time'), 
                'disabled' => $isElementDisabled,
                'singleClick'=> true,
                'date_format' => 'yyyy-MM-dd hh:mm:ss',
                'time'=>true
            ]
        );
8

Try following way:


$fieldset->addField(
            'time',
            'date',
            [
                'name' => 'time',
                'label' => __('Time'),
                'date_format' => 'yyyy-MM-dd',
                'time_format' => 'hh:mm:ss'
            ]
        );

  • Ho Do I add the backend form – Jaisa Mar 13 '18 at 4:08

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.