Reputation: 66
I have a DateTime column in a MySQL table that I'm trying to filter just from the time of the DateTime. So for example I need all rows that the time is 8am-9am on any date. Is this possible? I've looked through all the docs and can't find anything of the sort.
Thanks guys!
Upvotes: 0
Views: 31
Reputation: 76905
Use the TIME
function, like this
where TIME(myColumn) >= '08:00:00' and TIME(myColumn) <= '09:00:00'
TIME
gets the time part of your value.
Upvotes: 1