ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Date conversion to Day of Week

BarleyCorn
Asteroide

Trying to convert a date to day of the week. So field of actual date to new variable that is Monday, Tuesday, Wednesday, etc... based on the field date. Have tried DateTimeParse and DateTimeFormat functions in Formula Tool - no luck!

 

This is a basic excel command????

 

Thanks

 

15 RESPUESTAS 15
tz8888
Átomo

It worked. Thanks!

kurtwz
Asteroide
DateTimeAdd([DateField],5-ToNumber(DateTimeFormat([DateField],"%w")),"days")

 

This one wins. 🙂 🙂  If you want it to convert to the following Sunday, change the "...5-...' to a "...7-...".

KevinHarrison
Asteroide

You can use a datetime parse tool for this. Date/time to string - Custom - day (must be lower case I believe).

 

KevinHarrison_0-1608000168861.png

 

juanlevinig
Átomo

Nice!! Thanks for your support!

MRapp
Meteoro

This idea helped me!

For reference purpose, this is the correct syntax for a Saturday Week End Date.

You might want to apply the parse tool to get the HH:MM:SS out of the date as next step.

 

if DateTimeFormat([Invoice
Date],"%a") = "Sat" then DateTimeAdd([Invoice
Date],0,'days')

 

elseif DateTimeFormat([Invoice
Date],"%a") = "Sun" then DateTimeAdd([Invoice
Date],6,'days')

 

elseif DateTimeFormat([Invoice
Date],"%a") = "Mon" then DateTimeAdd([Invoice
Date],5,'days')

 

elseif DateTimeFormat([Invoice
Date],"%a") = "Tue" then DateTimeAdd([Invoice
Date],4,'days')

 

elseif DateTimeFormat([Invoice
Date],"%a") = "Wed" then DateTimeAdd([Invoice
Date],3,'days')


elseif DateTimeFormat([Invoice
Date],"%a") = "Thu" then DateTimeAdd([Invoice
Date],2,'days')


elseif DateTimeFormat([Invoice
Date],"%a") = "Fri" then DateTimeAdd([Invoice
Date],1,'days')
else ''
endif

 

Dev73
Asteroide

.

 

Etiquetas
Autores con mayor cantidad de soluciones