1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
1
try date_parse or from_iso8601_date function.
select date_parse(substr('2022-11-16T00:00:00.000Z',1,10),'%Y-%m-%d')
--OR TRY BELOW
select from_iso8601_date(substr('2022-11-16T00:00:00.000Z',1,10))
For a full list of functions, please check the reference based on the Athena Engine version you are using https://docs.aws.amazon.com/athena/latest/ug/functions.html Reference: https://trino.io/docs/current/functions/datetime.html?highlight=date_parse#date_parse
답변함 일 년 전
관련 콘텐츠
- AWS 공식업데이트됨 3년 전
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 2년 전
Thanks for your response, it helps!! (I was trying to avoid substring function in the beginning)
The above functions are helpful and I tried this as well and it worked- select date_parse(snapshot_date,'%Y-%m-%dT%H:%i:%s%.000Z') as date --> (This will convert to Date time (zone) format)
select date_parse(substr('2022-11-16T00:00:00.000Z',1,10),'%Y-%m-%d') --> (This will convert to Date time format)
select from_iso8601_date(substr('2022-11-16T00:00:00.000Z',1,10)) --> (This will convert to date format)