在 Athena(Glue 表)中将字符串转换为日期格式(MM-DD-YYYY)

0

【以下的问题经过翻译处理】 使用Glue Crawlers,我创建了Glue表并从Athena查询——如何将字符串转换为日期格式?“2022-11-16T00: 00: 00.000Z”。

我已尝试过使用to_date函数!

profile picture
전문가
질문됨 5달 전22회 조회
1개 답변
0

【以下的回答经过翻译处理】 尝试使用 date_parse 或 from_iso8601_date 函数。

select date_parse(substr('2022-11-16T00:00:00.000Z',1,10),'%Y-%m-%d')

或者尝试下面的函数

select from_iso8601_date(substr('2022-11-16T00:00:00.000Z',1,10))

关于所有函数的完整列表,请根据您所使用的 Athena 引擎版本查看参考文档 https://docs.aws.amazon.com/athena/latest/ug/functions.html 参考链接: https://trino.io/docs/current/functions/datetime.html?highlight=date_parse#date_parse

profile picture
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인