Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Convert CYYYYMMDD to MMDDYYY

blitz45
8 - Asteroid

Does anyone know how to convert date format CYYYYMMDD to MM/DD/YYYY?

5 REPLIES 5
jdunkerley79
ACE Emeritus
ACE Emeritus

I suggest:

 

 

 

 

DatetimeFormat(DateTimeParse([Input],"C%Y%m%d"),"%m/%d/%Y")

 

 

 

 

Sample attached.

BrandonB
Alteryx
Alteryx

Might be easiest to strip the first character with a formula tool, then use a date time tool to convert the string to a standard date format then use another date time tool taking the newly created date field and send back to a string in the exact format you desire. 

blitz45
8 - Asteroid

What if it is in the format below:

0940301 (March 01,1994) *0= within  the year 1900s

1190521 (May 21, 2019)     *1= within the year 2000s

JosephSerpis
17 - Castor
17 - Castor

Hi @blitz45 if you use this syntax in a formula tool should work DatetimeFormat(datetimeparse(
(IF LEFT([date],1)="1" THEN "20" ELSE "19" ENDIF)+RIGHT([date],6)
,'%Y%m%d'),"%m/%d/%Y")

 

This was one of the weekly challenges 

 

https://community.alteryx.com/t5/Weekly-Challenge/Challenge-58-An-Odd-String-to-Date-Conversion/td-p...

blitz45
8 - Asteroid

This is awesome! Thank you so much! It worked!

Labels
Top Solution Authors