Alteryx Designer Desktop Discussions

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

dynamic date formatting

COrr
7 - Meteor

Attached is workflow with a text input with multiple date formats.  I need all of these to match a MM/DD/YYYY format.  However I would also like to be able for the workflow to dynamically know that if its just the day and time then that means it's the current week.  Example: Mon 6:37 p.m. would be 08/24/2020.  However examples like Mon 08/17 would be changed to 08/17/2020.  This has had my head scratching for a couple of hours and was hoping for some help.

COrr_0-1598386604191.png

 

 

 

5 REPLIES 5
paulfound
11 - Bolide

Hi @COrr 

 

Assuming that there is only ever 3 formats and this week is = "Mon 4:47 PM ", last week is = "Thu 8/20" then "8/13/2020" for everything previous.

 

PaulFound_0-1598422165782.png

Bit messy but does the trick. 

 

Let me know how you get on.

COrr
7 - Meteor

Yes there are only the 3 formats.  Is the attached workflow supposed to be a stepping stone to the one in the picture?  Because it looks way different.

paulfound
11 - Bolide

Sorry, wrong file. Updated will match now. 🙂

COrr
7 - Meteor

this is just darn impressive.  it's going to take me a bit to understand the conditional expression on generate rows tool.  Thank you so much for your help!

paulfound
11 - Bolide

This is the first formula.

DateTimeAdd(DateTimeToday(),tonumber(DateTimeFormat(DateTimeToday(),"%w"))*-1,'days')

 

Basically this - DateTimeFormat(DateTimeToday(),"%w") gets the weekday number 0 being Sunday, 6 being Saturday. I times it by -1 to give me the inverse and add that number of days to today and you get Sundays date.

 

For the previous week I took another 7. 

 

Glad it helped anyhow.

 

 

Labels