Oracle - 如何获得一年中的第一个星期一?

Oracle - How to get first Monday of the year?

如何获取一年中的第一个星期一?

select TRUNC(date'2015-01-01','YYYY')
      ,NEXT_DAY(TRUNC(date'2015-01-01','YEAR')+1,'MONDAY')
from dual;

01-JAN-2015 05-JAN-2015

考虑到这一年可能从星期一开始,您需要先回到上一年的最后一天,然后才能转到下一个星期一;本年度:

next_day(trunc(sysdate, 'YYYY') - 1, 'Monday')

SQL Fiddle demo. This gives the first Monday of 2007 as January 1st; without the -1 adjustment it would say the 8th.

试试这个:

select next_day(round(sysdate,'yyyy'),'mon') from dual;