hive 常用的日期维度

SELECT 
next_day('2023-05-31','mo'), --下周一
date_add(next_day('2023-05-31','MO'),-7) as monday, --周一
date_add(next_day('2023-05-31','MO'),-1) as sunday,--周末
trunc('2023-05-31','MM') as mon_first,--月初
last_day('2023-05-21') as month_end,--月末
trunc('2023-05-31', 'YY') as year_first, --年初
date_sub(add_months(trunc('2023-05-31', 'YY'),12),1) as year_end,--年末
weekofyear('2023-05-31') as week --周
 

你可能感兴趣的:(hive,hive)