Home > Mobile >  Convert date isoString "2022-12-20T21:20:23.500Z" to format DD/MM/YYYY hh:mm in Athena sql
Convert date isoString "2022-12-20T21:20:23.500Z" to format DD/MM/YYYY hh:mm in Athena sql

Time:12-30

This is my actual date data

I would like to know if someone has the knowledge or knows how to format this date as mentioned in the title, I have already tried too many things, but I cannot solve it. I would appreciate your help or contribution

2022-12-20T21:20:23.500Z -> 20/12/2022 21:20

Update: if it helps anyone then i did this:

date_format( from_iso8601_timestamp('2009-10-30T17:59:55.047) at time zone 'UTC', '%d/%m/%Y %H:%i') as expiredate

CodePudding user response:

It is ISO 8601 timestamp format. Please first check data type then if it string you can convert it to date by

select from_iso8601_timestamp('2009-10-30T17:59:55.047') from mytable

https://queirozf.com/entries/presto-athena-examples-date-and-datetime-functions#convert-string-to-datetime-iso-8601-timestamp-format

Then you convert date datetype to any format you want

  • Related