I have a datetime field in mysql.
I need to select between these two date ranges in this format YYYY-MM-DD HH
“2012-12-20 10” and “2012-12-23 15”
How can I do this in mysql where utcdt is my datetime field?
SELECT DISTINCT utcdt
FROM rtb
WHERE
utcdt>=UNIX_TIMESTAMP("2012-12-20 10") and utcdt<=UNIX_TIMESTAMP("2012-12-23 15")
Use
BETWEENandSTR_TO_DATEas below: