I’m saving a date on a MySQL table through CActiveRecord.
I’ve tried formatting the date as m/d/yyyy and yyyy-mm-dd , but each time the date that ends up in the database is 1970-01-01.
I tried valid dates, say 5/5/1980 for instance.
Does I18N have anything to do with this?
Is there a way I can look at the SQL query generated when the model saves to the DB, so I can see if there’s an error there? or at least I can try it directly on mysql and see what happens.
I had the same problem, and this is what I came up with…probably not the best, but it’s working at this point…I had to do a ton of checks, with debugging straight to the screen at every step in the code.
First, added this as a parameter in my main.php (for MySQL database):
I still haven’t gotten the native datetime validation working though…it seems everytime yii tries to convert to the datetime type, you end up with the result you’re seeing.