- 时间类型DATE转为去掉-的数值类型INT
- 2021-01-14转为20210114,有以下两种方式
CAST(date_format(date'2021-01-14','%Y%m%d') AS INTEGER)
year(date'2021-01-14')*10000+month(date'2021-01-14')*100+day(date'2021-01-14')
- 2021-01-14 转为202101,有以下两种方式
CAST(date_format(date'2021-01-14','%Y%m') AS INTEGER)
year(date'2021-01-14')*100+month(date'2021-01-14')
- 反过来转
- 20210114转为2021-01-14
date(date_parse('20211012','%Y%m%d'))