0

I am trying to convert a date string field to a date. Problem is the string field has offset for Eastern time in it. How to convert it to date time?

Date String: 2016-09-21T10:01:43-04:00

This has to be converted to valid Date Time in Amazon AWS Athena. Tried From_iso8601_timestamp, date_parse. But no luck.

Piotr Findeisen
  • 19,480
  • 2
  • 52
  • 82
user1760178
  • 6,277
  • 5
  • 27
  • 57

1 Answers1

2

Use 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

(tested on Presto 309, but should work in Athena too)

Piotr Findeisen
  • 19,480
  • 2
  • 52
  • 82