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
asked 2 years ago1019 views
1 Answer
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
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions