Use PHP and MySQL. In my table, there is date field (datetime) recorded by NOW() sql function. Example value of data in this field is 2010-10-07 10:57:36. Ho
Try this
SELECT * FROM table WHERE DATE(my_date)=DATE(now())
my_date -> column name
Try this:
SELECT * FROM table WHERE date > CURDATE();
CURDATE()
will return the current date as 2011-10-07
which will be cast to 2011-10-07 00:00:00
when comparing datetime
s to it.
Note that if you use DATE(date) = CURDATE()
you will run a date conversion for every row in the table, which will be really bad for your perfomance if you have many rows and/or you need to run the query often. Also make sure you have an index on date
, otherwise both methods will be even slower.