Hi All,
I have a requirement to determine the first day of the week based on the locale.
For example,
- in US, the first day of this week is Sunday, March 29
- in Germany, the first day of this week is Monday, March 30
I know I can get the first day of the week using function WEEKDAY, so I tried below SQL which works, but since WEEKDAY is hardcoded Monday(0) to Sunday(6), the results are always giving the first day of the week as Monday.
| select | now() as "TODAY", |
| weekday(now()) as "WEEKDAY", | |
| add_days(now(), -weekday(now())) as "WEEK_FIRST_DAY" |
from dummy;
Any ideas how to make this locale dependent?
Thanks and best regards,
Cosmin