S. Gandhi
S. Gandhi

Reputation: 119

set minute 00 in datetimepicker (Example 27-02-2019 15:00)

I am new to yii2, can anybody know how to set minute 00 in datetimepicker in yii2 ??

<?= $form->field($model, 'start_date')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Choose Strating Date..'],
                        'pluginOptions' => [
                          'format' => 'dd-mm-yyyy hh:ii',
                          'autoclose' => true,
                          'minView' => 1,
                          'minute' => 00,
                          'startDate' => date('d-m-Y H:i'),
                          'hoursDisabled' => [0,1,2,3,4,5,6],
                        ]])->label(false); ?>

Upvotes: 0

Views: 165

Answers (2)

S. Gandhi
S. Gandhi

Reputation: 119

I have research and got the answer by doing this

'format' => 'dd-mm-yy hh:00',
'startDate' => date("d-m-y h"),

in plugin option but this is not fully satisfied because after doing this datetime picker will not highlight selected date so I am still looking for better solution.

Upvotes: 0

SiZE
SiZE

Reputation: 2267

Define $model->start_date value

$model->start_date = date('d-m-Y H:00');

and set startDate in format Y-m-d

['pluginOptions']['startDate'] = date('Y-m-d');

You may read doc of Bootstrap DateTimePicker plugin for more.

Upvotes: 1

Related Questions