Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have difficulties in understanding the behavior of the WeekDay function.
Today is Saturday. But I don't get the correct weekday.
Both in Sense & View, the settings are:
SET FirstWeekDay=6;
In View: WeekDay(Today()) shows Wed, Num(WeekDay(Today())) shows 3
In Sense: WeekDay(Today()) shows Thu, Num(WeekDay(Today())) shows 4
Edit:
In View, I Updated to WeekDay(Today(1)) and now I get Sat, as expected,
but the Num(WeekDay(Today(1))) shows 6, instead of 5.
Can someone please help me in better understanding this function?
Thanks!
The num of weekday () range from 0 to 6, 6 is the last day of the week.
If you set Sunday to be the first day of the week then Saturday will become the last, therefore the underlying num of Saturday will become 6 and the num of Sunday will become 0.
The num of weekday () range from 0 to 6, 6 is the last day of the week.
If you set Sunday to be the first day of the week then Saturday will become the last, therefore the underlying num of Saturday will become 6 and the num of Sunday will become 0.
Thanks for clarifying..
Now the Help is clearer:
"The integer returned by the function will now use the first day of the week that you set with first_week_day as base (0)."
This is done to get the sort order right on weekdays.