hive SQL日期應用

2021-10-24 18:17:53 字數 552 閱讀 6164

hive sql中日期的綜合應用

持續更新…

函式日期

current_date

今天的日期

-- 上周末,至往前12周

dt between date_sub(next_day(

current_date

,'mo'),

91)and date_sub(next_day(

current_date

,'mo'),

8)

unix_timestamp 日期轉時間戳

from_unixtime 轉回日期格式

--轉換標準時間格式後進行計算

--7200為2小時換成秒

select

from_unixtime(unix_timestamp(

'2021-01-01 12:00:00')+

7200

,'yyyy-mm-dd hh:mm:ss'

)--輸出為:2021-01-01 14:00:00

hivesql日期轉換

hivesql 日期轉換 2020 09 08 轉換為20200908 select from unixtime unix timestamp date sub current date,30 yyyy mm dd yyyymmdd select from unixtime 1564581347,y...

Hive sql計算日期差值

select concat date format date add datetime pmod datediff date add datetime 3 1900 01 08 7 yyyy.mm.dd date format date add datetime 6 pmod datediff da...

hiveSQL常用日期函式

注意 mm,dd,mo,tu 等要大寫 hive 可以在 where 條件中使用 case when 已知日期 要求日期 語句結果 本週任意一天 本周一select date sub next day 2016 11 29 mo 7 2016 11 28 本週任意一天 上週一select date ...