hive 数值(20210101)转日期(2021-01-01)

 IF(instr(substr(updated_at,1,10),'-')>0,date(substring(substr(updated_at,1,10),1,10)),date(from_unixtime(unix_timestamp(substring(substr(updated_at,1,10),1,10),'yyyymmdd'),'yyyy-mm-dd')))>=current_date - INTERVAL '3' DAY

select from_unixtime(unix_timestamp('20210101','yyyymmdd'),'yyyy-mm-dd')
,date(from_unixtime(unix_timestamp('20210101','yyyymmdd'),'yyyy-mm-dd'))

 

posted @ 2021-08-19 21:56  linbo.yang  阅读(1800)  评论(0编辑  收藏  举报