For my project, I need to have an absolute numerical correspondence between the days of the week and the values 1 ... 7.
As you probably know, the connection between days and numbers can vary depending on the locale, for example, in Germany on Monday 1 and Sunday 7, and on Monday in the USA 2 and Sunday 1.
So, looking for a solution, I found the following code that seems to work regardless of language, assigning Monday = 1 ... Sunday = 7:
1 + TRUNC (date) - TRUNC (date, 'IW')
Can someone explain to me how this works? In particular, I just can’t understand what this instruction is:
TRUNC (date, 'IW')
for sure.
source
share