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

04/14/2020                     2020-04-14

02/12/2020                     2020-12-02

 

Can you help me with this one pls?

3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @dunkindonut7777 

 

Here is how you can do it.

Formula :

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

 

Workflow:

atcodedog05_0-1628600351212.png

 

Hope this helps : )

Maskell_Rascal
13 - Pulsar

Hey @dunkindonut7777 

 

It looks like @atcodedog05 has you covered, but I wanted to share a great macro that is available on the Alteryx Gallery that can convert varying date types listed in the same field. 

 

The only prep needed from your example is to replace the space with a forward slash. 

 

Maskell_Rascal_0-1628601218092.png

 

Here is the link to download the macro: https://gallery.alteryx.com/#!app/BB-Date/577fe8aba248970840e6dd4d

 

Cheers!

Phil

 

atcodedog05
22 - Nova
22 - Nova

This is amazing @Maskell_Rascal. Thanks for sharing 🙂👍

Labels