Current Timestamp

hi, i have an assignment table contains the following fields

id, studentID, behaviorID, assignDate=> timestamp

in the assignment create form, i want the assignDate value the current timestamp

i tried to use this

<?php echo $form->textField($model,getTimestamp()); ?>

it gives me the following error:

Fatal error: Call to undefined function getTimestamp()

can you help me?

thank you




Timestamp: strtotime("now");

Date string format: date('Y-m-d H:i:s');



thank you. it works

You can solve this by defining default value for as timestamp in table structure, which will get auto current timestamp while adding a row to table

OR

In form

<?php echo $form->hiddenField($model,‘owner_id’,array(‘value’=>date(‘yy-m-d H:m:s’))); ?>

OR

In Model

protected function beforeSave() {

            if (&#036;this-&gt;isNewRecord)


            {

$this->assignDate=date(‘yy-m-d H:m:s’)

}

            else


            {

// some code for update

}

            parent::beforeSave();


            return true;


            }