Reputation: 39
I have a table with datetime like this:
2018-08-08 00:00:00
2018-08-08 03:00:00
2018-08-08 06:00:00
2018-08-08 09:00:00
2018-08-08 12:00:00
2018-08-08 15:00:00
2018-08-08 18:00:00
2018-08-08 21:00:00
2018-08-09 00:00:00
2018-08-09 03:00:00
2018-08-09 06:00:00
2018-08-09 09:00:00
2018-08-09 12:00:00
I search for rows between CURDATE() + INTERVAL 1 DAY and CURDATE() + INTERVAL 4 DAY, but also only at 06:00:00 and 12:00:00.
How can I select this hours?
Regards Wishy
Upvotes: 0
Views: 35
Reputation: 37472
You can use time()
to extract the time.
...
WHERE ...
AND time(nmuloc) BETWEEN time '6:00:00'
AND time '12:00:00'
...
Upvotes: 1