hive 已知日期计算是周几

#每天一点点,记录工作中实际可行操作#
hive 已知日期计算是周几
select distinct substr(start_time,1,10) start_date
,pmod(datediff(substr(start_time,1,10), ‘2012-01-01’), 7) week_day
-----2012-01-01是周日,数字0-6分别代表周日到周六,所以取标准值0;
from table_name
where start_time is not null
and substr(pt,1,8) >= ‘20181020’
and substr(pt,1,8) <‘20181023’

你可能感兴趣的:(hive)