Impala 日期格式错误
Impala Dateformat error
我的输入值为
161223000001
我需要转换成
2016-12-23 00:00:01
我试过了
select cast(161223000001 as timestamp)
7078-12-14 22:40:01
我得到的答案不正确
您可以使用 to_timestamp
函数将字符串转换为 Impala
中的时间戳
SELECT to_timestamp('161223000001', 'yyMMddHHmmss');
通过在您最初的尝试中使用 CAST AS TIMESTAMP
,它会将给定的字符串识别为 unix 纪元时间
我的输入值为
161223000001
我需要转换成
2016-12-23 00:00:01
我试过了
select cast(161223000001 as timestamp)
7078-12-14 22:40:01
我得到的答案不正确
您可以使用 to_timestamp
函数将字符串转换为 Impala
SELECT to_timestamp('161223000001', 'yyMMddHHmmss');
通过在您最初的尝试中使用 CAST AS TIMESTAMP
,它会将给定的字符串识别为 unix 纪元时间