Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

CONVERSION OF DATE

dunkindonut7777
8 - Asteroid

Hi I would like to ask if how can I easily transform or convert the date field which combines both "date and string" type of data. 

 

Date:                               Expected Output:

 

02 05 2020                      2020-02-05

03 12 2020                      2020-03-12

2020-01-27                     2020-01-27

2020-07-14                     2020-07-14

 

Can you help me with this one pls. Thank you

3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @dunkindonut7777 

 

You can use formula like below

 

IF Contains([Date], " ")
THEN DateTimeParse([Date],"%m %d %Y")
ELSE DateTimeParse([Date],"%Y-%m-%d") ENDIF

 

Workflow:

atcodedog05_0-1628591364968.png

 

Hope this helps : )

 

dunkindonut7777
8 - Asteroid

Thank you for this. I would just like to add if how can I replace the "/" sign in the date figure, from 04/20/2020 to 04 20 2020?

atcodedog05
22 - Nova
22 - Nova

Hi @dunkindonut7777 

 

To answer this question to can replace() within contain like below.

IF Contains(Replace([Date], "/", " "), " ") 
THEN DateTimeParse([Date],"%m %d %Y") 
ELSE DateTimeParse([Date],"%Y-%m-%d") ENDIF

 

Workflow:

atcodedog05_0-1628600536029.png

 

Hope this helps : )

Labels