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.
SOLVED

Converting Multiple date types

Benk95
7 - Meteor

Hello Alteryx Community,

 

I am relatively new to Alteryx so forgive me if this seems simple.

 

I have a large dataset (6m rows or so) with horribly inconsistent date formats, saved as V_Strings, which I need to convert to a standard format. The image attached gives you an example; it's mostly a combination of dd-mm-yyyy and dd-mm-yyyy, but we also have yyyy-mm-dd, numeric formats and who knows what else.

 

Does anyone have any tips about how to manage this? Everything I have tried so far has been fruitless.

 

Many Thanks!

 

 

4 REPLIES 4
kat
12 - Quasar

Hi @Benk95

 

That's quite something!! The only way I can think of solving this is with regex. You'd have to filter your data, depending on which pattern it matches and then apply the formula to convert it and put it all back together. 

 

here is an example - you just need to create a stream for each date type. 

 

dates.PNG

jdunkerley79
ACE Emeritus
ACE Emeritus

I attach another approach.

 

2018-10-29_16-26-54.png

 

This time using formula tool to tidy up the input.

 

1. Remove the pure numbers and treat them as Excel dates (days since 31 Dec 1899)

2. Replace any / or \ with a -

3. Pad single digits with a 0

4. Finally try a date time parse on MM-DD-YYYY if not already in YYYY-MM-DD format

Benk95
7 - Meteor

Thanks both, the first suggestion worked perfectly with a bit of trial and error.

 

I'd never heard of the REGEX functions, looks like I still have a lot to learn!

 

 

newuser980345483
7 - Meteor

Hello - thank you for this suggestion. It was helpful, however, I am still having one issue with a date format. Similar to this user, I have multiple date formats, one of which is 09-APR-19.

 

I tried using this as the REGEX_Match, but it is coming back as false. I am new to REGEX so am not sure how to specify my parameters.

 

REGEX_Match([Date], '\d{2}-\d{3}-\d{2}')

 

Any help you can provide would be appreciated! 

 

 

Labels