Amazon Athena - 将时间戳转换为日期? [英] Amazon Athena - Converting Timestamp to Date?

查看:258
本文介绍了Amazon Athena - 将时间戳转换为日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看 Date/Time Athena 文档,我没有看到一个功能来做到这一点,这让我感到惊讶.我看到的最接近的是 date_trunc('week', timestamp) 但这会导致类似 2017-07-09 00:00:00.000 的结果,而我希望格式为是 2017-07-09

Looking at the Date/Time Athena documentation, I don't see a function to do this, which surprises me. The closest I see is date_trunc('week', timestamp) but that results in something like 2017-07-09 00:00:00.000 while I would like the format to be 2017-07-09

是否有一个简单的函数可以将时间戳转换为日期?

Is there an easy function to convert a timestamp to a date?

推荐答案

没有转换函数的原因是,这可以通过类型转换来实现.

The reason for not having a conversion function is, that this can be achieved with a type cast.

因此转换查询将如下所示:

So a converting query would look like this:

select DATE(current_timestamp)

这篇关于Amazon Athena - 将时间戳转换为日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆