Hi Alteryx gurus,
I am trying to convert a string field to date type. The data value is in format like 05-May-17 as a string. I tried the formula below, but the results shows as "2017-05-1" that missing partial value..
DateTimeParse([GL_DATE],"%d-%b-%y")
In the formula, I could not change the size field 9 to 10...
Someone please help. Thank you!!
Flora
Solved! Go to Solution.
Other option, if you wanted to do this the slightly longer way is:
- use text-to-columns to split the year, month, day into their own columns (string type)
- where the year is shorter than 4 characters, add 20 or 19 to it using a formula
- bring these back into a single string of format 2017-05-10 using a formula tool.
- you can then just use a select tool to convert this to a date since this is Alteryx's internal representation of a date (yyyy-mm-dd)
Hopefully this gets you to a solution :-)
Cheers
Sean
Thanks Sean! for sharing many options here. The DateTime Parse tool works!
Thank you Joe. This is what exactly I am looking for since I have more than 1 data type fields with this issue.
Thank you!
Flora
It help me, thanks.