Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
ALTER.NEXT:

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

SAVE YOUR SPOT
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!
SOLVED

Inconsistent Date format (string)

Highlighted
Alteryx Community Team
Alteryx Community Team

Here is the blog post that goes along with the macro. The last paragraph might help point you in the right direction.

Highlighted
Alteryx Partner

Hi Mark,

your formula works great, I tried to add another condition for my use case. my date could come in as:

 

20200610 therefore would like it output as 2020-06-10

my current result looks like 2020--30

 

Thank you

 

IF
Contains([date],"-") THEN date
ELSEIF
Contains([date],"/") THEN Regex_Replace([date],"(\d{1,2})(/)(\d{1,2})(/)(\d{4})","$5-$1-$3")
ElSEIF
Contains([date],"") THEN Regex_Replace([date],"(\d{4})(\d{1,2})(\d{1,2})","$1-$5-$3") ELSE Null() ENDIF

 

 

Labels