Yii: Saving date and time in DB

Posted by FaisalKhan on Stack Overflow See other posts from Stack Overflow or by FaisalKhan
Published on 2012-11-10T10:05:05Z Indexed on 2012/11/10 17:00 UTC
Read the original article Hit count: 401

Filed under:
|
|

I am having trouble saving the date in DB through Model. In my controller, if I dump the date in log that I receive from $_POST , I get the date in this format "10/Nov/2012 07:30". If I use:

$AccountAppointment->start_date=Yii::app()->dateFormatter->format($_POST['AccountAppointment']['start_date'], 'dd/M/yyyy HH:mm');

I get the error:

Invalid datetime format: 1292 Incorrect datetime value: '10/NoGMT+5/2012 07:30' for column 'start_date' 

Changing the format in dateFormatter to 'dd/M/yyyy HH:mm' or 'dd/MM/yyyy HH:mm' or 'dd/MMM/yyyy HH:mm' throws the same error.

Db is MySQL 5.0, Yii version 1.1.12.

Any help would be greatly appreciated, I am almost stuck....thanks....

© Stack Overflow or respective owner

Related posts about datetime

Related posts about model