MySQL timestamp "today"


How do I get results for entries added “today.” I have a field in the table, timestamp with current timestamp option enabled. So when each entry is inserted. It adds current timestamp to it (I’m assuming it’s server time, which I want). I am not sure which condition to put to get entries of today i.e. whether if only few minutes passed since today or even 20 minutes. so what should be after this:

.... WHERE `timestamp` =

Please help. :slight_smile:


guido, that produces the correct result, but very slowly (table scan)

this is better –

WHERE `timestamp` >= CURRENT_DATE
  AND `timestamp`  < CURRENT_DATE + INTERVAL 1 DAY

Thanks exactly what I wanted :slight_smile:

I always forget about that table scan stuff when using a function on a table field… :nono: