Sqlite Enters "current_Timestamp" Instead Of The Actual Timestamp

I have a basic table, current_date field is set to type DATETIME

When I create a record with yii (current_date field set to CURRENT_TIMESTAMP) , it simply enters CURRENT_TIMESTAMP in the table , not the actual date/time .

But when I enter a row by opening sqlitemanager, it works fine .

You need to post the code that you’re using.

I didn’t modify anything , everything is created by gii. not sure what code to post here?

If you’re using CRUD then CURRENT_TIMESTAMP is going to be treated as a string. You’ll likely need to modify the generated code.


below fixed my issue as you suggested

public function actionCreate() {

        $model = new Users;

        // Uncomment the following line if AJAX validation is needed

        // $this->performAjaxValidation($model);

        if (isset($_POST['Users'])) {

            $model->attributes = $_POST['Users'];

            $model->create_date = date('Y-m-d H:i:s');

            if ($model->save())

                $this->redirect(array('view', 'id' => $model->id));

        }else {

           $this->layout = '//layouts/admincolumn2';

            $this->render('create', array(

                'model' => $model,




Or you could use:

$model->create_date = new CDbExpression('CURRENT_TIMESTAMP');