ITPub博客

首页 > 数据库 > Oracle > 关于Oracle to_char()函数中的IW,WW 周别显示

关于Oracle to_char()函数中的IW,WW 周别显示

原创 Oracle 作者:tolywang 时间:2008-03-24 09:49:35 0 删除 编辑

查今天是 "今年" 的第几周

  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.

[@more@]

周日都是第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博客 ” ,链接:https://blog.itpub.net/35489/viewspace-1001371/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    14696698