# TimePicker

> Bootstrap time picker for Yii2 forms

Package entry: `yii2-extensions/time-picker`. Requires PHP `>=8.3`, Yii2 `~2.0.55 || ^22.0@dev`. Checked 2026-11-22. [View the entry in the package directory](</docs/packages/yii2-extensions/time-picker/index.md>)

**Bootstrap time picker for Yii2 forms**

_Standalone and model-bound inputs, configurable display formats, and canonical form submission_

Select a time with the mouse or keyboard arrow keys. This extension grew out of Kartik Visweswaran's Krajee widget,
which wrapped [rendom's TimePicker plugin](https://github.com/rendom/bootstrap-3-timepicker), forked from
[jdewit's TimePicker](https://github.com/jdewit/bootstrap-timepicker).

![Studio booking form with the start time picker open, a 24-hour end time field, and both submitted values in HH:mm:ss](/docs/_astro/time-picker-light.DKvyWRtK.png)

## Features

![TimePicker features: Yii2 forms, Bootstrap 3/4/5, time formats, layouts and bundled assets](https://raw.githubusercontent.com/yii2-extensions/time-picker/main/docs/svgs/features.svg)

## Quick start

### Installation

Install with [Composer](https://getcomposer.org/download/):

```bash
composer require yii2-extensions/time-picker:^2.0
```

Load the Bootstrap CSS that matches your application's `bsVersion`. On Yii 2.0.55, you can use an installed Yii
Bootstrap asset adapter; on Yii 22, provide the Bootstrap CSS and npm jQuery assets in the application. See the
[installation guide](https://github.com/yii2-extensions/time-picker/blob/main/docs/installation.md) and
[upgrade notes](https://github.com/yii2-extensions/time-picker/blob/main/UPGRADE.md).

### Basic usage

Render a standalone input:

```php
use yii\helpers\Html;
use yii2\extensions\timepicker\TimePicker;

echo Html::label('Start time', 'start-time');
echo TimePicker::widget(
    [
        'name' => 'start_time',
        'value' => '11:24 AM',
        'options' => ['id' => 'start-time'],
        'pluginOptions' => [
            'showSeconds' => true,
        ],
    ],
);
```

Or bind the widget to a model attribute inside an existing ActiveForm:

```php
use yii2\extensions\timepicker\TimePicker;

echo $form
    ->field($model, 'start_time')
    ->widget(
        TimePicker::class, [
            'pluginOptions' => [
                'showMeridian' => false,
                'defaultTime' => false,
            ],
        ]
    );
```

## Documentation

Practical guides and usage examples for time inputs, Bootstrap integration and canonical form submission.

- 📚 [Installation Guide](https://github.com/yii2-extensions/time-picker/blob/main/docs/installation.md)
- ⚙️ [Configuration Guide](https://github.com/yii2-extensions/time-picker/blob/main/docs/configuration.md)
- 💡 [Usage Examples](https://github.com/yii2-extensions/time-picker/blob/main/docs/examples.md)
- 🔄 [Upgrade Guide](https://github.com/yii2-extensions/time-picker/blob/main/UPGRADE.md)
- 🧪 [Testing Guide](https://github.com/yii2-extensions/time-picker/blob/main/docs/testing.md)

The guides and the [API reference](https://yii2-framework.github.io/docs/extensions/time-picker/reference/) generated
from the PHPDoc in `src/` are published at <https://yii2-framework.github.io/docs/extensions/time-picker/>.

## AI assistance

AI agents: read the [documentation index](https://yii2-framework.github.io/docs/llms.txt) and fetch the Markdown version
of a page by appending `index.md` to its URL. The
[AI agents guide](https://yii2-framework.github.io/docs/project/ai-agents/) covers skill installation, client setup and
verification.

- 🤖 [`yii2-time-picker` skill](https://github.com/yii2-extensions/time-picker/blob/main/docs/agents.md): configure
  Bootstrap markup, icons, and plugin options; verify submitted time values and form behavior.

See the [repository guides](#documentation), the [skill source](https://github.com/yii2-extensions/time-picker/blob/main/skills/yii2-time-picker/SKILL.md), the source PHPDoc,
and the [changelog](https://github.com/yii2-extensions/time-picker/blob/main/CHANGELOG.md). Check the guides against the installed revision before applying examples.

## Special thanks

Originally developed by Kartik Visweswaran as [Krajee TimePicker](https://github.com/kartik-v/yii2-widget-timepicker).
Stefano Mtangoo adapted the extension for Yii2 Extensions. The upstream copyright and BSD-3-Clause terms remain in
[LICENSE.md](https://github.com/yii2-extensions/time-picker/blob/main/LICENSE.md).

## Our social networks

[Follow on X](https://x.com/Terabytesoftw)
[Follow on Facebook](https://www.facebook.com/wilmer.arambula.9)
[Join our Subreddit](https://www.reddit.com/r/Yii2/)
[Join on Telegram](https://t.me/yii_framework_in_english)

## License

[License](https://github.com/yii2-extensions/time-picker/blob/main/LICENSE.md)

The bundled Bootstrap Timepicker JavaScript and CSS also carry Joris de Wit's [MIT notice](https://github.com/yii2-extensions/time-picker/blob/main/src/assets/LICENSE).

## Package

- Source code and issues: [yii2-extensions/time-picker](https://github.com/yii2-extensions/time-picker). Star the repository if the package is useful to you.
- Composer package: [yii2-extensions/time-picker](https://packagist.org/packages/yii2-extensions/time-picker).
- Changelog: [CHANGELOG.md](https://github.com/yii2-extensions/time-picker/blob/main/CHANGELOG.md).