Answer the question
In order to leave comments, you need to log in
Date Time. How to determine that the date is greater and the time is less?
There is a column of type DATETIME. Stores the date and time in the form yyyy-MM-dd HH:mm:ss
Is it possible to do the following without dividing the time and date into separate columns:
display those rows where the date is greater than 2015-09-22 and the time is less than 15:00: 00
Answer the question
In order to leave comments, you need to log in
SELECT *
FROM table
WHERE
DATE_FORMAT(datefield, '%Y-%m-%d') > '2015-09-22' AND
DATE_FORMAT(datefield, '%H:%i:%s') < '15:00:00'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question