1. 输出date对应星期几?
select pmod(datediff(to_date( date),’1900-01-08’),7)+1 as week_day
2. 输出date上周周日?
select date_sub(date,pmod(datediff(date,'1900-01-08'),7)+1) as Last_Sunday;
3. 输出date上周周一?
select date_sub(date,pmod(datediff(date,'1900-01-08'),7)+7) as Last_Monday;
4.date所在周的周一?
select date_sub(date,pmod(datediff(date,’1900-01-08’),7)) as Monday_Date;
网友评论