IW:Same day of the week as the first day of the ISO year. 

解决方案 »

  1.   

    TRUNC(d,fmt)
    TRUNC returns d with the time portion of the day truncated to the unit specified by the format model fmt. If you omit fmt, d is truncated to the nearest day.IW   Same day of the week as the first day of the ISO year. eg:
    SELECT TRUNC(TO_DATE('27-OCT-92','DD-MON-YY'), 'YEAR')
    "New Year" FROM DUAL;
     
    New Year
    ---------
    01-JAN-92
     
      

  2.   

    SQL> select to_char(sysdate,'iw') from dual;TO_CHAR(SYSDATE,'IW')
    ---------------------
    24iw:根据iso标准的年中的第几周(1-52,1-53)
      

  3.   

    'IW'在to_char中,是表示第几周,
    而在trunc中是表示周第1天的日期
      

  4.   

    举个列子,今天是 2003-5-9,星期一
    SQL> alter session set nls_date_format='yyyy-mm-dd hh:mi:ss';
    Session altered.SQL> select TRUNC(SYSDATE,'iw'),sysdate from dual;
    TRUNC(SYSDATE,'iw') SYSDATE                                                     
    ------------------- -------------------                                         
    2003-06-09 12:00:00 2003-06-09 03:42:32 将系统时间改变为2003-5-13,星期五
    SQL> select TRUNC(SYSDATE,'iw'),sysdate from dual;TRUNC(SYSDATE,'iw') SYSDATE                                                     
    ------------------- -------------------                                         
    2003-06-09 12:00:00 2003-06-13 03:45:32  
    再分别解释一下,trunc是截尾函数,iw表示该日期是一年中的第几个星期,所以 TRUNC(SYSDATE,'iw')返回该星期中的星期一  北京海天起点技术服务有限公司
    三号工程师
    www.hthotizon.com.cn