TIDB
date_format(loan_time,’%Y-%m’)
date(loan_time)
Impala
from_timestamp()
to_date
date_format(date_sub(now(),INTERVAL 1 DAY),’%Y-%m-%d’)
from_unixtime(unix_timestamp(now()), ‘yyyy-MM-dd’)
Hive
substr(loan_time,1,7)
date_format(loan_time,‘yyyy-MM’)
date(loan_time)
取前一天yyyyMMdd:
etl_tx_dt=cast(date_format(date_sub(from_unixtime(unix_timestamp(),‘yyyy-MM-dd’),1),‘yyyyMMdd’) as int)