#now(),获取当前时间戳的日期格式['Y-m-d H:i:s']
#sysdate().获取当前时间戳的日期格式['Y-m-d H:i:s']
select now()
select sysdate();
#curdate() 获取当前时间戳的日期格式['Y-m-d'] current_date()
select curdate();
select current_date();
#curtime()/current_time 获取当前时间戳的时间格式['H:i:s']
select curtime();
select current_time();
# 获得当前 UTC(格林尼治时间) 日期时间函数:utc_date(), utc_time(), utc_timestamp()
select utc_time(),utc_date(),utc_timestamp()
#dayofweek(date)获取日期一周中属于周几
#dayofmonth()获取日期在一月中属于第几天
#dayofyear()获取日期在一年中属于第几天
select dayofweek('2014-11-17')
select dayofmonth('2014-11-17')
select dayofyear('2014-11-17')
#5. MySQL 返回星期和月份名称函数:dayname(), monthname()
select dayname();
select monthname();
#last_day()返回日期月份中最后一天的日期
select last_day('2014-11-17');
#date_add(now(),sss)返回一个增加设定的日期
select date_add('2014-11-17',interval 2 day)
select date_add('2014-11-17',interval 1 week)
#date_sub(now(),sss) 返回一个减少特定设定的日期
select date_sub('2014-11-17',interval 2 day)
#period_diff(date1,date2)比较两个日期相差的月数
period_diff(201411,201408);
#unix_timestamp()获取当前的时间戳
select unix_timestamp();
#from_unixtime()将时间戳转化为日期格式
select from_unixtime(unix_timestamp(),'%Y-%m-%d');
#date_format格式化日期格式
select date_format(now(),'%Y-%m-%d');