我试图将以下格式的时间戳字符串转换为时间戳格式,但遇到了这样的错误:
Invalid format: "20201216T090000+0000" is malformed at "0000+0000"
原始查询
SELECT from_iso8601_timestamp(date_ts)
FROM
...
我曾想过将substr应用于仅作为字符串检索20121216T09
,我知道这将适用于from_iso8601_timestamp
。但任何其他建议都将不胜感激!
from_iso8601_timestamp()
支持带破折号和冒号的格式:
presto> SELECT from_iso8601_timestamp('2020-12-16T09:00:00+00:00');
_col0
-----------------------------
2020-12-16 09:00:00.000 UTC
在输入被格式化为类似20201216T090000+0000
的情况下,parse_datetime()
将更合适。