Reputation: 45
Why 12/16/2013 and 12/17/2013 are in different week?
alter session set NLS_TERRITORY=AMERICA;
select to_char(to_date('12-16-2013', 'mm-dd-yyyy'),'ww'),to_char(to_date('12-17-2013', 'mm-dd-yyyy'),'ww') from dual
Upvotes: 4
Views: 3846
Reputation: 12179
If you look at the formatting models documentation, it states:
01/01/2013 started on a Tuesday last year, not the first day of week. So in your test case, 12/17/2013 was on a Tuesday also, and a new "week" as oracle calculates it. Certainly, non-obvious.
Upvotes: 3