1.当前日期的获取;
`select Now(),CURRENT_TIMESTAMP(),SYSDATE(),SLEEP(2),NOW(),CURRENT_TIMESTAMP(),SYSDATE(); #sysdate()慢两秒`
2.当前时间的加减
~~~
select now() as now,
date_add(now(),interval 1 day) as tomorrow,
date_sub(now(),interval 1 day) as yesterday
#1 day 也可以是 -1 day
#1 day 也可以是1 year,1 hour
~~~
3.日期格式化函数date_formate
`select date_format(now(),'%Y%m%d') as datetime; #日期函数在where中不走索引`
4.datediff #返回两个日期的天数;
5.