Ads by ProfitSence

Comparing dates in MYSQL

Last Updated on Wednesday 5th Oct 2022

my sql date comparison

Compare a date from a database that is between 2 given dates

					select date_format(date(starttime),'%Y-%m-%d') from data
where date(starttime) >= date '2012-11-02';


format string %Y-%m-%d and the format of the input date

  • In MySQL you can use the DATE function to extract the date from a datetime
					SELECT * FROM tab WHERE DATE(date) BETWEEN '2000-07-05' AND '2011-11-10'