Alteryx Designer Desktop Discussions

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

How to convert String date with spell out months to date format

blitz45
8 - Asteroid

My example is slightly a little different from the ones I have been seeing in the threads. 

 

I want to be able to convert YYYY-MM (ie. 2021-OCT) to YYYY-MM-DD (ie. 2021-10-01). Is there a way to do that? I found a long way of doing it using formula but wanted to see if there's a simple and short way? 

 

blitz45_1-1679002896948.png

 

 

Thank you!

 

10 REPLIES 10
SPetrie
12 - Quasar

Use this in a formula tool and it should give you what you need.

DateTimeParse([date]+"-01","%y-%b-%d")

SPetrie_1-1679003578537.png

 

 

binuacs
20 - Arcturus

@blitz45 One way of doing this

binuacs_0-1679003634536.png

 

RyanMaxwell
5 - Atom

I am assuming that your Date field is of the String data type.  I used the DateTime tool in the Parse tab to accomplish this.

 

RyanMaxwell_0-1679003719971.png

(1) - Select String to Date/Time Format

(2) - Select the field containing the string you want to convert to the desired date format.

(3) - Specify a name for the new date column.

(4) - Select "Custom" in the format matching the incoming string field and specify the format of the incoming field as yyyy-MMM.

 

Hope this helps.

 

RyanMaxwell_2-1679003984168.png

 

blitz45
8 - Asteroid

omg! these are all great solutions! Thank you all sooo much! 

 

blitz45
8 - Asteroid

@RyanMaxwell It's a string but some how it is null once I convert it to the same format as yours.

binuacs
20 - Arcturus

@blitz45 Can you provide your input data?

blitz45
8 - Asteroid

@binuacs  yours worked as well. I meant RyanMaxwell's option.

 

here's a screenshot incase you  wanted to check it out.

blitz45_0-1679005442248.png

 

RyanMaxwell
5 - Atom

Can you add a screenshot of the Configuration pane? Double check that the format of the incoming field is yyyy-MMM.

binuacs
20 - Arcturus

@blitz45 are you changing the data type to datetime format in the select tool?

 

binuacs_0-1679006034893.png

 

Labels