Hive sql 获取当前日期是周几(星期几)

select
case when pmod(datediff(local_time,'2018-01-01') + 1,7) = 1 then 'Monday'
	 when pmod(datediff(local_time,'2018-01-01') + 1,7) = 2 then 'Tuesday'
	 when pmod(datediff(local_time,'2018-01-01') + 1,7) = 3 then 'Wednesday'
	 when pmod(datediff(local_time,'2018-01-01') + 1,7) = 4 then 'Thursday'
	 when pmod(datediff(local_time,'2018-01-01') + 1,7) = 5 then 'Friday'
	 when pmod(datediff(local_time,'2018-01-01') + 1,7) = 6 then 'Saturday'
	 else 'Weekend'
	 end time_interval
from
ccsd.ecc_week_operation_peak;

你可能感兴趣的:(hive)