presto中的时间函数
作者:互联网
1.获取两个时间差的天数:select date_diff('day',cast('2018-09-05' as timestamp),cast('2018-09-07' as timestamp)) as time_diff
获取dt 到当前的时间天数之差: select date_diff('day',dt,current_date) as day_diff
date_diff('day' or 'hour' or 'second',dt1,dt2) 'day','hour','second'表示天数、小时数、秒数
举例date_diff( 'hour',cast(updatetime as timestamp),CURRENT_TIMESTAMP) =2 表示和当前时间做比较两小时
标签:函数,hour,presto,timestamp,cast,时间,date,diff,day 来源: https://www.cnblogs.com/qcjcode/p/16250406.html