sqlamazon-athena

Converting Date Timestamp from UTC to EST without the Timezone in Athena


I am trying to convert a datetimestamp column from UTC to EST without the output including the timezone, and also CAST it as a timestamp.

I have tried the below, but the resulting column of the query is still in UTC and not EST.

    CAST(at_timezone(datetimestamp_column,'US/Eastern') AS timestamp)
    CAST(datetimestamp_column AT TIME ZONE 'US/Eastern' AS timestamp)

Solution

  • Here's how you can convert between timezones in Athena:

    SELECT at_timezone(with_timezone(TIMESTAMP '2022-11-01 09:08:07.321', 'UTC'), 'US/Eastern')

    This returns 2022-11-01 05:08:07.321 US/Eastern