查今天是 "今年" 的第几周
select to_char(sysdate,'ww') from dual;
或
select to_char(sysdate,'iw') from dual;
附注:
上文所提之iw及ww格式在doc内解释如下
IW = Week of year (1-52 or 1-53) based on the ISO standard
WW = Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
周日都是第12周
select to_char(to_date('20080323','yyyymmdd'),'WW') from dual;
select to_char(to_date('20080323','yyyymmdd'),'IW') from dual;
周一其中一个是 12 周,一个是第 13 周 。 按照中国习惯应该式 IW (ISO Standard Week ) 比较合适 。
select to_char(to_date('20080324','yyyymmdd'),'WW') from dual;
select to_char(to_date('20080324','yyyymmdd'),'IW') from dual;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-1001371/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/35489/viewspace-1001371/