将带有偏移量的DateString转换为Athena / Presto中的有效日期/时间戳

问题描述 投票:0回答:1

我正在尝试将日期字符串字段转换为日期。问题是字符串字段在其中具有偏移的东部时间。如何将其转换为日期时间?

日期字符串:2016-09-21T10:01:43-04:00

这必须在Amazon AWS Athena中转换为有效的日期时间。试过From_iso8601_timestamp,date_parse。但没有运气。

sql datetime amazon-athena prestodb timezone-offset
1个回答
2
投票

使用from_iso8601_timestamp

presto> select from_iso8601_timestamp('2016-09-21T10:01:43-04:00');
             _col0
--------------------------------
 2016-09-21 10:01:43.000 -04:00

(在Presto 309上测试过,但也应该在Athena中工作)

© www.soinside.com 2019 - 2024. All rights reserved.