Date Control Demo yii2-datecontrol   Tips

Latest Stable Version Latest Unstable Version Total Downloads Monthly Downloads Daily Downloads
Thankful to Krajee!
to get more out of us.

NOTE: This extension depends on the kartik-v/yii2-krajee-base extension which in turn depends on the yiisoft/yii2-bootstrap extension. Check the composer.json for this extension's requirements and dependencies that may be updated by composer.


This is a demo on the kartik\datecontrol\DateControl widget. You can configure the various options for the widget.
Generated Date Control
Input saved as:
Widget Code
echo $form->field($demo, 'datetime_1')->widget(DateControl::classname(), [
    'type' => 'date',
    'ajaxConversion' => true,
    'autoWidget' => true,
    'widgetClass' => '',
    'displayFormat' => 'php:d-F-Y',
    'saveFormat' => 'php:Y-m-d',
    'saveTimezone' => 'UTC',
    'displayTimezone' => 'Asia/Kolkata',
    'saveOptions' => [
        'label' => 'Input saved as: ',
        'type' => 'text',
        'readonly' => true,
        'class' => 'hint-input text-muted'
    'widgetOptions' => [
        'pluginOptions' => [
            'autoclose' => true,
            'format' => 'php:d-F-Y'
Configure Date Control

This demo example uses different timezones for display and save. You can check this better by using the datetime or time formats. Note that the date format will skip all timezone conversions.