Start Free Trial

Alteryx Designer Desktop Discussions

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

Converting string to date format

cokeke
5 - Atom

Hi,

How do I convert string data type in MM-YYYY to date format in Month, YYYY? I have tried to use Datetime tool and DateTimeParse function but it is not working for me. I am either getting a null result or conversion error.

Below is an example of an input data( string data type)

1-2017

2-2017

3-2017

4-2017

5-2017

6-2017

 

12-2017

 

Desired output( date data type)

January, 2017

February, 2017

March, 2017

April, 2017

May, 2017

June, 2017

 

December 2017

 

I have tried to use the datetime tool using the selection below

cokeke_0-1654137037748.png

 

But I get this result below, which is not the desired format.

cokeke_1-1654137208801.png

 

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@cokeke 
We need to convert the string to a DateTime data, then convert back to String with your desired output.
note that " January, 2017" can not be a Data type, it is a String.
Here is the complete reference, and I always check the syntaxes. 😁

https://help.alteryx.com/20221/designer/datetime-functions

0602-cokeke-1.PNG0602-cokeke-2.PNG0602-cokeke-3.PNG

 

binu_acs
21 - Polaris

@cokeke Another way of doing this with the DateTime functions. 

 

DateTime Functions | Alteryx Help

 

binuacs_0-1654144681119.png

 

grazitti_sapna
17 - Castor

@cokeke, another way to solve this issue in case you wish to use datetime tool

 

grazitti_sapna_0-1654146027401.png

 

Thanks!

Sapna Gupta
Divyaverma2906
7 - Meteor

how can we convert this other way around. Jan,2017 to 01/01/2017

binu_acs
21 - Polaris

@Divyaverma2906 One way of doing this

binuacs_0-1686150422394.png

 

Labels
Top Solution Authors