Hive-早于x天

idfiyjo8  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(236)

在aws athena表中,我有一个timestamp列,

select  eventtime from cloudtrail_logs limit 1
eventtime
--------- 
2016-10-21T01:18:28Z

我需要得到超过7天的事件时间。
我试过了 current() , unix_timestamp 但运气不好。

uinbv5nw

uinbv5nw1#

select  *
from    cloudtrail_logs 
where   eventtime >= date_format(current_date - interval '7' day,'%Y-%m-%d')
;

澄清:

select date_format(current_date - interval '7' day,'%Y-%m-%d');

2017-03-12

相关问题