hive 常用日期格式转换
把固定日期转换成时间戳
select unix_timestamp('2020-05-29','yyyy-MM-dd') --返回结果 1590681600
select unix_timestamp('20200529','yyyyMMdd') --返回结果 1590681600
select unix_timestamp('2020-05-29T13:12:23Z', "yyyy-MM-dd'T'HH:mm:ss'Z'") --返回结果 1590729143
select unix_timestamp('2020-05-29 13:12:23', 'yyyy-MM-dd HH:mm:ss') --返回结果 1590729143
把 29/May/2020:11:30:03 +0800 转成正常格式(yyyy-MM-dd hh:mm:ss)
select from_unixtime(to_unix_timestamp('29/May/2020:11:30:03 +0800', 'dd/MMM/yyy:HH:mm:ss Z'))
--返回结果 2020-05-29 11:30:03
时间戳转换成固定日期
select from_unixtime(1590681600,'yyyy-MM-dd') --返回结果 2020-05-29
select from_unixtime(159