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
Solved! Go to Solution.
It worked. Thanks!
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-...".
You can use a datetime parse tool for this. Date/time to string - Custom - day (must be lower case I believe).
Nice!! Thanks for your support!
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