Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Day of week as number

Pascal_R
8 - Asteroid

Hi Team,

 

Is there a way to get the number of a weekday out of a date?

Currently my data set is like below type: V_string. 

 

I want to have a new column next to this Ac.GI date which say like:

 

"5" for the 12.11.2021 (Friday) etc...

 

Pascal_R_0-1636970261728.png

 

 

8 REPLIES 8
Christina_H
14 - Magnetar

DateTimeFormat([Ac.GI date],'%w')

 

Goes from Sunday = 0 to Saturday = 6

JulioMO
9 - Comet

Attached you will find a solution. 

 

Best regards

Pascal_R
8 - Asteroid

Hi @Christina_H 

 

If I just add the formula I only have nulls. Can you please check attached file and let me know if I need to chance any format or so?

 

BR,

Pascal

afv2688
16 - Nebula
16 - Nebula

Hello @Pascal_R ,

 

Just one little thing to add here would be if you want to be sunday the seventh day insted of the first would be to add a replace to the formula too.

 

Replace(DateTimeFormat([Field1],'%w'),'0','7')

 

Regards

afv2688
16 - Nebula
16 - Nebula

Hello @Pascal_R ,

 

You need first to transform the dates to actual dates that Alteryx can understand. As the stand on your file they are interpreted just as text. Try using this

 

Replace(DateTimeFormat(DateTimeParse([Ac.GI date],'%d.%m.%y'),'%w'),'0','7')

 

Regards

Christina_H
14 - Magnetar

@Pascal_R

 

As @afv2688 says, you need to convert your date to a date format in Alteryx first.

ATP_1973
5 - Atom

Is there a way to have it where Sunday is 1, Monday 2, etc.?

CoG
14 - Magnetar

@ATP_1973 

Use ToNumber(DateTimeFormat([Date], "%w"))+1

Labels
Top Solution Authors