What exactly does trunc(date, 'IW')?

TRUNC(DATE,'IW') returns the first day of the week. For me TRUNC(SYSDATE,'IW) returns Monday. Today is Tuesday Feb 21. Subtract from that TRUNC(SYSDATE,'IW') which would be Monday the 20th, and you'll get 1 (because 21-20=1). Add 1 onto that as you do in the beginning of your equation and you get 2, which we associate with Tuesday.


The very basic concept of ISO week is to make it NLS territory independent.

From documentation,

Week of year (1-52 or 1-53) based on the ISO standard.

A week starts on a Monday and ends on a Sunday.