Posts o[mysql] query datetime field only by time
Post
Cancel

o[mysql] query datetime field only by time

we have these records :

using :

1
2
3
SELECT *
FROM  user_working_hours
WHERE EXTRACT(HOUR_SECOND from date_start) between 100000 and 100500

using :

1
2
3
SELECT *
FROM  user_working_hours
WHERE EXTRACT(HOUR_SECOND from date_start) between 100000 and 100600

using :

1
2
3
SELECT *
FROM  user_working_hours
WHERE (EXTRACT(HOUR_SECOND from date_start) between 100000 and 100600) AND (EXTRACT(HOUR_SECOND from date_end) between 153000 and 153100)

just for the history, using :

1
2
3
SELECT *
FROM  user_working_hours
WHERE HOUR(date_start)>15

origin - http://www.pipiscrew.com/?p=1658 mysql-query-datetime-field-only-by-time

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags