Alteryx Designer Desktop Discussions

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

Todays date in Day of week

Pascal_R
8 - Asteroid

Hi Team,

 

Is there a formula which is creating a column with the current day of the week number?

Like if today is Tuesday (16.11.2021)  it should give me 2 (staying for second day of a week).

 

Best regards,

Pascal

9 REPLIES 9
AngelosPachis
16 - Nebula

Hi @Pascal_R ,

 

I don't think there's a native function within Alteryx that does that, but you can come up with your own by using a lookup table.

 

AngelosPachis_0-1637052612976.png

 

afv2688
16 - Nebula
16 - Nebula

Hello @Pascal_R ,

 

You can easily do it with this formula:

 

 

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

 

 

What I am doing here is first take your date and transform it into a date time format, afterwards I select the day of the week with the %w parameter.

 

For last what I do is replace the sunday '0' with '7' but thats just in my case. For me the week starts on mondays 🙂

 

Untitled.png

 

Regards

messi007
15 - Aurora
15 - Aurora

Hello,

 

Please see below :

 

DateTimeFormat([DateField],"%w")

 

You can fin more details here : https://help.alteryx.com/20213/designer/datetime-functions

 

Hope this helps,

Regards.

Pascal_R
8 - Asteroid

@afv2688 @AngelosPachis 

 

Thank you already for you help!

 

Is there a way to just put it into the formula tool?

Like to take DateTimeToday() for each time when I run it?

 

BR,

Pascal

AngelosPachis
16 - Nebula

Yes @Pascal_R ,

 

Like @afv2688  pointed out and I missed in my post above, you can put his expression in a  formula tool and it will work. Still there's not something similar to the datetimetoday() function, but it will still work.

 

You can read more about the datetime functions within Alteryx in the following post:

https://help.alteryx.com/20213/designer/datetime-functions

afv2688
16 - Nebula
16 - Nebula

Hello @Pascal_R ,

 

I don´t know if this is what you mean but you can add it of course to the datetimetoday formula:

 

Replace(DateTimeFormat(DateTimeToday(),'%w'),'0','7')

 

Regards

HomesickSurfer
12 - Quasar

Hi @Pascal_R 

 

Use the following expression in a Formula tool:

The DateTimeStart() is better than DateTimeToday() if in the event that you want to capture the day in which the workflow started and not when it ended, if running over midnight.

 

DateTimeFormat(DateTimeStart(),"%w")

 

Peggy
7 - Meteor

Learned something new - always something new to learn in Alteryx-land.  Thank you.  I like this method for its simplicity 🙂 

Peggy
7 - Meteor

Thanks !  This is exactly what I was looking for. Love the Alteryx community. 

Labels