TO_DAYS Sql function of time

1. Obtain day data: TO_DAYS (a.last_operation_date) = TO_DAYS (NOW ())

a.last_operation_date: time saved in the database field, now () indicates the current time

TO_DAYS (now ()): returns from year 0 to start now () a number of days now

2.curdate (): Get the current date 

curtime (): Get the current time every minute

now (): Gets the current date and time

Note: The judge stepped on today's date pit: time between curdate () and curdate () + 1: // [2018.08.08 00:00:00 2018.08.09 00:00:00] both contain

3.date_sub (date, INTERVAL expr type) function

data: Time

expr: Positive Negative interval backwards when the number of days or years ahead spaced intervals

type: When possible date

 

 

 

Guess you like

Origin www.cnblogs.com/huoyufei/p/11240788.html