Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dafnis14
Specialist
Specialist

WeekDay Confusement

 

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!

 
Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

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.

View solution in original post

3 Replies
Vegar
MVP
MVP

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.

dafnis14
Specialist
Specialist
Author

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)."

Vegar
MVP
MVP

This is done to get the sort order right on weekdays.