Hi all,
I decided to store only unixtime (from 1.1.1970, epoch) in my database, the benefit is an easy conversion to different timezones, simple calculations and no problems with the 1-hour shift due to day-light-saving two times a year. So the CActiveModel classes have only unixtime in their properties.
Now I want to make some views to change data on the model, also the date/time properties. As recommended the controller simply do a massive-assignment, so don’t deal with the properties and their content. The views basically only fill a form with the data requested by the model.
But the problem is, that I don’t want to show the unixtime to the user, they should see a locale dependent formatted date like “dd.mm.yyyy” and also enter this format. Even a simple form of offering a text-input line where the user sees and enter a date/time string is not so easy to be converted in unixtime due to the MVC architecture…
(Best would be to use the CJuiDatePicker but this seems to have a bug not being compatible in unixtime format (see here) and it also still shows the ugly unixtime number)
How to convert unixtime from inside model to locale format in view within the Yii way of MVC/ActiveRecord/MassiveAssignment…
Thanks a lot
Achim