日期转时间戳
select EXTRACT(epoch FROM CAST( '2018-03-08 00:00:00' AS TIMESTAMP))===>1520467200
时间戳转日期需要注意时区
SELECT TO_TIMESTAMP(1544195978.549)
##
日期相关函数
date()函数
select date(‘2018-01-01 10:20:12’)====》2018-01-01
to_date()函数
select to_date(‘2018-03-12 18:47:35’,‘yyyy-MM-dd hh24:mi:ss’) ====>2018-03-12
to_timestamp()函数
select to_timestamp(‘2018-03-12 18:47:35’,‘yyyy-MM-dd hh24:mi:ss’)==>2018-03-12 18:47:35+08
select to_timestamp(‘2018-03-08’,‘yyyy-MM-dd’)===>2018-03-08 00:00:00+08