This question is more like searching for best solution. I know how to do it in my way. :D
I have few time-intervals as words:
today
,tomorrow
,this_week
,this_month
;
The problem is that time is saved in the database as UNIX time-stamp.
I will try to show an example. Lets say it's today
. That means that I need to select results from database that has been made from start til end of this day.
This means that I need to get current day's first second:
mktime(0, 0, 0);
...last second:
mktime(23, 59, 59);
And query the database with something like this:
WHERE `timestamp` >= first_second OR WHERE `timestamp` <= last_sencond
And yea, I need to write this for all possible strings that are allowed. Are there any neater solution?
Thanks in an advice! :)