Alteryx Designer Desktop Discussions

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

Month Year String to Date?

TheRhino
6 - Meteoroid

I have two columns of data with date information - one Double, with year, and another Double, with Month

 

I have created another column with Month in String format so I have that as well

 

I've been able to create a combined String column by converting the Year into String and using the expression [Month]+"-"+[String Year]

 

I cannot figure out how to convert this to a date field using the DateTimeParse formula

 

Is there another combination of double/string values I should be using? What other conversions do I need to do?

 

I've read every help page of time/date to no avail!

Thanks!

18 REPLIES 18
TheRhino
6 - Meteoroid

One more issue now (corrected the % positioning!)

 

Now, only some of the dates convert and others do not... Why is this?

Capture.PNG

RodL
Alteryx Alumni (Retired)

Did you change to a capital 'B'?

TheRhino
6 - Meteoroid

YES thank you!!!! I should have posted here first before wrestling with the formulations. 

 

 

Anuashka
5 - Atom

Hello ,

 

I am facing a similar problem in alteryx. I have a String field in the format 082009 which is the month and year of payment. I am trying to convert this into a date format. I am using the formula as below but I get a null field as a result with conversion errors. 

 

DateTimeParse([Payment_Date],'%m, %Y')

RodL
Alteryx Alumni (Retired)

It needs to have a "day" in order to assign the full date.

 

Try something like...

DateTimeParse('01' + [Payment_Date], "%d%m%Y")

...which will default it to the first day of the month.

tmvg
6 - Meteoroid

I have read the existing posts and tried everything I could think of but failed so far. Please help.

My date string looks like "JAN 2017".  I tried DateTimeParse([MyDateString], "%m %Y") but get an error.

The error message reads, 'Month number is out of range 1..12'.

DanM
Alteryx Community Team
Alteryx Community Team

@tmvg

 

If you are attempting to format this into a numbered date, you will want to use DateTimeParse([MyDateString],"%B %Y"). The result will be 2017.01.01. You can find all of the date function here for reference under the Specifiers section https://help.alteryx.com/2018.1/index.htm#Reference/DateTimeFunctions.htm

tmvg
6 - Meteoroid

Thank you, DanM.

Yes, I am trying to format it into Date. I tried what you suggested but I still get the same error. I don't understand what is wrong.....

I will keep on trying. Thanks again.

 

 

JanaZ
7 - Meteor

Hi RodL,

 

I have a date 201909, need to convert to 30/09/2019, how can I do it?

 

thanks

Jana

Labels