show functions看一下,发现还蛮多的,需要注意天月时分秒之类的返回的都是数字,不会自动补0,可以使用lpad补全
year 获取年
month 获取月
weekofyear 获取周
day 获取日
hour 获取小时
minute 获取分钟
second 获取秒
datediff 【A,b】返回 B到A的天数
date_add【a,b】返回 日期a增加b天
unix_timestamp 标准时间转成时间戳
select unix_timestamp(’2011-12-07 13:01:03′) from dual;
1323234063
from_unixtime 时间戳转成标准时间
select from_unixtime(1323308943,’yyyyMMdd’) from dual;
20111208