查询当前日期是一年中的第几周
select to_char(to_date(v_month, 'yyyymmdd'), 'YYYYIW') from dual;
select to_char(sysdate, 'YYYYIW') from dual;
--ISO标准(判断本周为哪年的依据是看哪一年的天数多,比如2016年第一周为1.4-1.10,因为上一周只有周五、周六、周天三天在2016年,故这三天算作是2015年53周)
一周的开始和结束时间
select ROUND(to_date('2014-1-1','yyyy-mm-dd') + 7*(1-1)-1, 'DAY') + 1 from dual;
select ROUND(to_date('2014-1-1','yyyy-mm-dd') + 7*(1-1)-1, 'DAY') + 7 from dual;
select to_char(to_date(v_month, 'yyyymmdd'), 'YYYYIW') from dual;
select to_char(sysdate, 'YYYYIW') from dual;
--ISO标准(判断本周为哪年的依据是看哪一年的天数多,比如2016年第一周为1.4-1.10,因为上一周只有周五、周六、周天三天在2016年,故这三天算作是2015年53周)
一周的开始和结束时间
select ROUND(to_date('2014-1-1','yyyy-mm-dd') + 7*(1-1)-1, 'DAY') + 1 from dual;
select ROUND(to_date('2014-1-1','yyyy-mm-dd') + 7*(1-1)-1, 'DAY') + 7 from dual;