1. Go to this page and download the library: Download omnilight/yii2-datetime library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
omnilight / yii2-datetime example snippets
/**
* @property string posted_at This is your property that you have in the database table, it has DATETIME format
*/
class Post extends ActiveRecord
{
// ... Some code here
public function behaviors()
{
return [
'datetime' => [
'class' => DateTimeBehavior::className(), // Our behavior
'attributes' => [
'posted_at', // List all editable date/time attributes
],
]
];
}
}
// $model has instance of Post
<?= $form->field($model, 'posted_at_local')->widget(\yii\jui\DatePicker::className(), \omnilight\datetime\DatePickerConfig::get($model, 'posted_at_local'))
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.