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'))

原文地址:https://www.cnblogs.com/linbo3168/p/15164201.html