Compare dates in MySQL

后端 未结 5 1866
野性不改
野性不改 2020-11-27 03:31

I want to compare a date from a database that is between 2 given dates. The column from the database is DATETIME, and I want to compare it only to the date format, not the d

5条回答
  •  广开言路
    2020-11-27 04:33

    This works for me:

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

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

提交回复
热议问题