Skip to content
Advertisement

Weekday number regardless of the NLS settings

I’m looking for the simplest way to determine the weekday number for the DATE value in oracle independent of the NLS settings.

Any ideas?

Advertisement

Answer

ISO weeks start on Monday; they don’t use NLS settings. I think this expression is reliable.

To show how the arithmetic works . . . current_date is a Wednesday.

In general, if you can’t find an expression that reasonably does what you expect, you can always use a table. (And, perhaps, a function that isolates SQL from the underlying implementation.)

So you can always use something like

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement