function to get the current time: Now (), Curdate (), Curtime ()
Now (): 2008-12-29 16:25:46
Curdate (): 2008-12-29
Curtime (): 16:25:46
Gets the data in the table that is greater than or equal to today, and less than tomorrow:
SELECT * FROM table WHERE createdtime >= curdate () and Createdtime < Date_sub (Curdate (), INTERVAL-1 Day)
Today is August 01, 2016.
Date_sub (' 2016-08-01 ', Interval 1 day) says 2016-07-31
Date_sub (' 2016-08-01 ', Interval 0 day) says 2016-08-01
Date_sub (' 2016-08-01 ', interval-1 day) says 2016-08-02
Date_sub (Curdate (), Interval 1 day) represents 2016-07-31
Date_sub (Curdate (), Interval-1 Day) 2016-08-02
Date_sub (Curdate (), Interval 1 month) represents 2016-07-01
Date_sub (Curdate (), Interval-1 month) represents 2016-09-01
Date_sub (Curdate (), Interval 1 year) represents 2015-08-01
Date_sub (Curdate (), Interval-1 year) represents 2017-08-01
MySQL's judgment on time function