from: Oracle的文档
IW "Week of year (1-52 or 1-53) based on the ISO standard. "很有可能最后几天属于下一年的第一个星期,就像454周的规则一样。
还是先研究研究ISO 关于日期的standard吧!
IW "Week of year (1-52 or 1-53) based on the ISO standard. "很有可能最后几天属于下一年的第一个星期,就像454周的规则一样。
还是先研究研究ISO 关于日期的standard吧!
------
200301
我想自能這樣解釋:年份是2003年,但是這個星期是下一年2004年的第一個星期
SQL> select to_char(to_date('20040104','yyyymmdd'),'yyyyiw') from dual;TO_CHA
------
200401
SQL> select to_char(to_date('20040105','yyyymmdd'),'yyyyiw') from dual;TO_CHA
------
2004022003年的12月29到31和2004年的一月1到4號是2004年的第一個星期的
------
200401
我覺得結果應該是200402.
SQL> select to_char(to_date('20031229','yyyymmdd'),'yyyyiw') from dual;TO_CHA
------
200301
這個結果更是奇怪。ISO應該不會這樣吧?
ISO 8601 Representation of dates and times.
This standard defines a lot of details of the calendar.
E.g. the ISO definition of the week numbers is that the
first day (day number 1) of a week is Monday and that the
first week in a year (week number 1) is the week that includes
the first Thursday in January, i.e. the first week that has at
least four days in January.
------
200052
我越搞越糊塗了。上面的ISO規定好象不詳細吧?哪裡有詳細資料?