I have a table with a field of the type DATETIME in the database.
Now i want to compare if this field is greater or less than the actual time so i can indicate if the time has passed or not when displaying this record.
What would be the best solution for this. Yes one could use CDateParser, but since the DATETIME field also contains the time I will have to do some preprocessing before I pass it on. This preprocessing might be location dependent, I don't know.
Is it a good idea to add an extra calculated field in the Model for the table. If so, how do I do that an can even be done?
Yes i suppose it would be better done with SQL. But can i create a calculated field in the CActiveRecord like 'date<NOW() as isOld' and use isOld when i display a record or even use it to tell if the record can be edited.
As for the actual logic to compare a datetime string to another date via php, idk on the top of my head, but I fell like google would have a lot of knowledge on that. CakePHP had a helper for this I think, so you could look at their code too.