dev-master
9999999-devInitiates database date columns as DateTime PHP classes.
BSD-3-Clause
The Requires
by David Hirtz
extension yii2 datetime
Initiates database date columns as DateTime PHP classes.
Initiates database date columns as DateTime PHP classes., (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist davidhirtz/yii2-datetime-behavior "*"
or add, (*4)
"davidhirtz/yii2-datetime-behavior": "*"
to the require section of your composer.json
file., (*5)
Once the extension is installed, simply use it in your code by adding it to your ActiveRecord behavior. If you don't set the attributes all "date" and "datetime" columns will be automatically selected., (*6)
use davidhirtz\yii\datetime\DateTimeBehavior; public function behaviors() { return [ [ 'class'=>DateTimeBehavior::class, //'attributes'=>['custom_attribute', 'another_attribute'], ], ]; }
Initiates database date columns as DateTime PHP classes.
BSD-3-Clause
extension yii2 datetime