How can I select data from MySQL based on date (unix time record)
I have a data record with a unix time date in it
I want to select a row based on date / month / year only (not with time)
I am currently using something like this
select *
from tablename
where date > '$today'
and date < '$tomorow'
LIMIT 1;
no matter how accurate it would be if $ today and $ tomorrow have different times (but at the same time)
Is there a better way to do this?
+2
a source to share
2 answers
... WHERE DATE(FROM_UNIXTIME(date)) > DATE(FROM_UNIXTIME('$today')) ...
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
+2
a source to share