I’m creating my first application using Yii (great stuff). I created a MySQL table with a date column and did the scaffolding (model + crud) for this table. To create a record the create view is displayed. I am able to enter a date in the generated textfield and save the record. However, I need to use the format YYYY-MM-DD because otherwise the date is not saved correctly.
I already found that MySQL does not support any other format than YYYY-MM-DD for date fields. So what’s the best approach to make the corresponding PHP (and generated HTML forms) work with f.e a MM-DD-YYYY format? I want to have the DD-MM-YYYY format in all of the generated views (create, update, show, list etc) without adapting to much code.
I’ld rather not do conversions for every date and datefield in my application. Is there any way to set the default date format for PHP and client side?
Should I use another MySQL type for dates to make life easier?
Does the Yii framework support this issue in some way?
Thanks Horacio. I already stumbled on this extension. All extension zip files seem to be corrupt though, so I was not able to try this. I’ll let you know if it worked for me when the zip files are fixed.