Alteryx Designer Desktop Discussions

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

text to date conversion

tww
8 - Asteroid

Hi all,

 

I am new to Alteryx, and looking for some help on the conversion of the following text strings to proper date format:

 

InputInput formatexpected output format
210802yymmdd2021/08/02
2021214yyyyddd (last three digit in Julian format)2021/08/02
80321mmddyy2021/08/03
8022021mmddyyyy2021/08/02
21214yyddd (last three digit in Julian format)2021/08/02

 

Also how do I avoid this error "Cannot convert "0" to a date/time"? Should I replace 0 with null?

 

Thank you in advance for your help

3 REPLIES 3
SPetrie
12 - Quasar

Are all these formats coming to you in one column from the same source, or is this just a grouping of examples formats you need help with?

Individually, these can be tackled with formulas or the date/time tool. If these are coming to you like this, where they are all intermixed, its going to make it a bit trickier to get these to all properly format. 

If the later case is true, I would start by having a conversation with whatever monster decided to allow all those formats in a single column and see if they can clean it up before it gets to you lol.

Individually they can be parsed with these formulas. 

InputInput formatAlteryx formula
210802yymmddDateTimeParse("20"+[Input],"%y%m%d")
2021214yyyyddd (last three digit in Julian format)DateTimeParse([Input],"%Y%j")
80321mmddyyDateTimeParse(PadLeft([Input],6,"0"),"%m%d%y")
8022021mmddyyyyDateTimeParse(PadLeft([Input],8,"0"),"%m%d%y")
21214yyddd (last three digit in Julian format)DateTimeParse("20"+[Input],"%y%j")

 

The tricky part will be if these are all in one column. A formula to parse one of the date formats may work on the other but give you incorrect information as seen with the formula for the second Julian date.

SPetrie_0-1679515971497.png

 

tww
8 - Asteroid

Thank you very much, SPetrie. They were just different formats I got from different fields. So your solution is what I am looking for.

 

By the way for "210802", what is the reason that this - DateTimeParse([Input],"%y%m%d") would not work?

Dina
9 - Comet

This is the explanation from Alteryx Documentation. 

Dina_0-1679517164605.png

 

Labels