yii2 - using TimestampBehavior automatically setting timestamp created_at and updated_at

yii2
voted: 1
vote
php yii2 date activerecord

To automatically set created_at and updated_at TimestampBehavior can be used. In model extending ActiveRecord put following lines:

<?php
use yii\behaviors\TimestampBehavior;

public function behaviors()
{
    return [
        TimestampBehavior::className(),
    ];
}
?>
working url: not entered
version: 2
Leave a Comment:
Characters left:
No comments yet.