Retrieve iso 8601 timestamp

0

How to fetch timestamp values which are in the iso 8601 format from Athena to QuickSight.

idshipdatestatusiso_8601Epoc
12022-02-09 07:00:00OPEN2022-07-26T00:15:41+00:001658794541394
22022-08-02 20:00:00CLOSED2022-07-31T21:46:23+00:001659303983100
32022-08-02 21:00:00OPEN2022-07-31T21:46:23+00:011659303983100

I am using the below query,but i am unable to fetch any rows matching with the iso_8601 timestamp.

Query:

select epoc,iso_8601,shipdate,from_unixtime(cast(substr(cast(1658794541394 as varchar), 1, 10) AS bigint)) from newtable where iso_8601 >= from_unixtime(cast(substr(cast(1658794541394 as varchar), 1, 10) AS bigint))

The from_unixtime(cast(substr(cast(1658794541394 as varchar), 1, 10) AS bigint)) is returning the value as 2022-07-26 00:15:41.000 but the column iso_8601 has value 2022-07-26T00:15:41+00:00. Hence my query is not meeting the condition.

Could you please let me know how to resolve the issue.

AWS
已提问 2 年前1045 查看次数
1 回答
0

iso_8601 is interpreted as string , you need to convert with parseDate function i.e. parseDate(replace(substring({date_in_ISO},1,19),'T'," "),'yyyy-MM-dd HH:mm:ss')

For more help refer parseDate

profile pictureAWS
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则