1、获取当前的时间戳
select unix_timestamp() from dim_kpi;
2、时间戳转时间
备注:转化UNIX时间戳(从1970-01-0100:00:00 UTC到指定时间的秒数)到当前时区的时间格式
select from_unixtime(1558166130,'yyyy-MM-dd HH:mm:ss') from dim_kpi;
3、日期转时间戳
select unix_timestamp('2019-05-18 13:01:03') from dim_kpi;
4、上一条,其中可以指定参数的时间格式,转为时间戳:
select unix_timestamp('20190518 13:01:03','yyy