I am starting to learn php using Yii, and I have a big question, maybe you can help me.
I am using a form to create users. I want to store the data of the users that I introduce in the form into the DB (MySQL), but I also must store the date and the time in the datetime field of the DB. I saw some extensions like CJUIDATEPICKER to pick the date, but I don't know any extension to pick the datetime. I think that the better way is to store the datetime automatically when I create a new user. Now I have a textbox in the form where I have to introduce the datetime with the format yyyy-mmmm-dddd hh:mm:ss, but I think that it isn't useful.
Please, someone coud help me and explain to me how to store a datetime when I create a register into the DB?
Thank you very much.
EDIT:
Now I use "$model->reg_date=new CDbExpression('NOW()');" inside the actionCreate() controller and it works well but I think that would be better to show this datetime inside the field of the user creation form before you write anything and to store all the fields of the form when you click on submit. I tried to do it but as you can imagine the field only show "NOW()"
This is part of my code of the form in _form.php:
<div class="row">
<?php $model->reg_date=new CDbExpression('NOW()');?>
<?php echo $form->labelEx($model,'reg_date'); ?>
<?php echo $form->textField($model,'reg_date'); ?>
<?php echo $form->error($model,'reg_date'); ?>
</div>
Someone could help me?
Thank you again!