我必须还原日期转换 一开始是
CAST(FROM_UNIXTIME(UNIX_TIMESTAMP(t0.date_creation , 'yyyyMMdd'T'hhmmss')) AS TIMESTAMP)
现在我正在研究如何将时间戳转换为'yyyyMMdd'T'hhmmss'
格式
语法CAST(date_creation as string format 'yyyy-MM-dd hh:mm:ss')
不起作用
答案 0 :(得分:1)
使用date_format
函数:
select current_timestamp, date_format(current_timestamp,"yyyyMMdd'T'HHmmss") as result;
返回:
2020-10-09 15:03:36.584 20201009T150336
在此处了解格式:SimpleDateFormat