Hi, I’m new to the board so sorry if this is in the wrong section/missing something/etc.
I have a GridView of some data with a couple dates, such as "Date Created". Right now these fields are stored in MySQL as a DATETIME or VARCHAR(20) (the code is a bit messy at the moment).
We’re planning on a multinational user base, so we can’t use the MySQL server’s local timezone. Ideally, these dates would simply be type INT and contain the unix timestamp. Everything about this works great, except the GridView filters. Formatting the dates to be readable in the GridView is easy, but the filter compares what you type in to the stored value, not to the formatted value. So if I type in “2010”, it’s going to look for all the data with unix timestamps equal to “2010”, not dates that start with “2010” as it does with string-based dates.
The only thing close to a solution I’ve found so far is to modify the model’s search() method, specifically these things:
$criteria->compare('createDate',$this->createDate,true);
The problem is, you can only format the filter value ($this->createDate), not the actual DB column.
We really want to be able to use these filters, and we really don’t want to use MySQL’s DATETIME or TIMESTAMP formats. Anyone have any ideas? Thanks so much for your help.