Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
evansabres
Specialist
Specialist

Weekday

I have a date field 'DOB' which is formatted as mm/dd/yy (3/21/2017)

Is there a way within the script to indicate the 'Day Name' in so that I can have a field called Week Day?

I tried WeekDay(DOB)          AS          dayofweek  however this returns the numeric value of the date, whereas I am looking for the actual day name (Monday, Tuesday, etc)

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

what about:

Date(DOB, 'WWWW') As WeekDayLongName

View solution in original post

7 Replies
sunny_talwar

I am getting Tue when I tried this

WeekDay(Today())

Capture.PNG

Can you check your environmental variables for this?

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

evansabres
Specialist
Specialist
Author

I am trying to do this in the script. I want to create a field called weekday so that I can then utilize that field in charts, list boxes, tables, etc.

My environmental variables are set in the correct manner.

sunny_talwar

Should give your the name (in the script also) unless you are using Num() function over it?

maxgro
MVP
MVP

maybe, if in a listbox DOB is on the left

weekday(date#(DOB, 'M/D/YYYY'))

evansabres
Specialist
Specialist
Author

My data:

ItemSale DepartmentMaster Sale DepartmentDOBDaypartQuantityNet AmountGross Amount
BreadsHS CondimentsFood1/30/2017LUNCH100

My script:

DOB              as businessdate,

Month(DOB)    as    month

Year(DOB)      as    year

Is there a way to do this in the script to produce a day of week field that will appear as Monday, Tuesday, Wednesday, etc

Frank_Hartmann
Master II
Master II

what about:

Date(DOB, 'WWWW') As WeekDayLongName

MarcoWedel

Hi,

one solution might be also:

QlikCommunity_Thread_254226_Pic1.JPG

SET DateFormat='MM/DD/YYYY';

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

SET LongDayNames ='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';

table1:

LOAD *,

    DOB                                as businessdate,

    WeekDay(DOB)                        as dayofweek,

    Dual(Date(DOB,'WWWW'),WeekDay(DOB)) as longdayofweek,

    Month(DOB)                          as month,

    Year(DOB)                          as year

FROM [https://community.qlik.com/thread/254226] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco