Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Complex date converison

wtahir
7 - Meteor

Hi everyone,

 

I have a date conversion question. I am struggling since yesterday already to deal with this problem. My dates are in verious formats like:

 

2009-1-24

01/24/2009
05-24-2015
24-01-2015
march-2019
Feb,2020
January-16th-2020
2019-March
2019, May

 

How can I bring them all into a same format e.g (yyyy-mm-dd) ? I went through many date time related posts but never found any post dealing with this complexity. Could you guys please help me out here?

 

7 REPLIES 7
atcodedog05
22 - Nova
22 - Nova

Hi @wtahir 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1605790716540.png

Workflow:

atcodedog05_1-1605790735989.png

 

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

jamielaird
14 - Magnetar

Hi @wtahir,

 

Here's one possible solution:

 

1) Add a column to your dataset that defines the format of the date e.g. YYYY-MM-DD, MM/DD/YYYY etc. This will require some manual work, so if you have lots of records you might want to use the formula tool to add some checks that will help you, e.g. counting the number of slashes and hypens and the length of the string and then sorting by these fields to group similar dates.

 

2) Use the Filter tool to seperate each group of records with a certain date format into a different stream

 

3) Add a DateTime tool and configure it appropriately for each given date type. You'll find lots of information and guidance on this tool here: https://help.alteryx.com/current/designer/datetime-tool

 

There might be APIs or Python libraries out there that can handle this in a more automated fashion, so if you have a massive volume of data or expect to need to do this multiple times you might want to explore that avenue.

jamielaird
14 - Magnetar

Well there you go - you got a generalized solution from me and a specific solution from @atcodedog05, and if you combine the two I think you'll be well on your way to solving this. Let us know how you get on.

wtahir
7 - Meteor

@atcodedog05, your solution works perfect. Highly appreciate your help and ofcourse you get a like from me 🙂

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @wtahir 

 

Cheers and Happy Analyzing 😀

 

Feel free to reach out if you face any other issues 🙂

wtahir
7 - Meteor

@jamielaird thank you for your useful advise. I would surely have to look into it. I am totally new to alteryx but have worked with python before so I was trying to translate some regex ideas combined with python's dataframe but nothing was working and @atcodedog05 made my day. Truly appreciate this great help from this wonderful community

wtahir
7 - Meteor

@atcodedog05 I will keep that in mind. Thank you so much 🙂

Labels