V
V
ValeraValera2017-07-19 10:25:24
PHP
ValeraValera, 2017-07-19 10:25:24

SQL How to select records for a specific date from 9.00 to 21.00 datetime format field [0000-00-00 00:00:00]?

The records are in the wp_konkurs table and they have a user_time field in the datetime format [0000-00-00 00:00:00]
how to make a query to select records for a specific date from 9.00 to 21.00, or is there another time interval for example?
And I will be glad to links to articles on the topic.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Zakharov, 2017-07-19
@cluberr

SELECT * FROM `wp_konkurs` WHERE `user_time` BETWEEN "2017-01-01 09:00:00" AND "2017-01-01 21:00:00"

G
gill-sama, 2017-07-19
@gill-sama

SELECT * FROM wp_konkurs WHERE CAST(user_time AS time)   BETWEEN CAST('09:00:00' AS time) AND CAST('21:00:00' AS time)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question