Alteryx Designer Desktop Discussions

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

Converting string to Date

pvara
8 - Asteroid

I have the following string that I have been trying to convert to date. 'October 28, 2015, 11:33 AM ET' I have tried using the various tools within Alteryx and simple forumula tool. Basically all I want is either 28-10-2015 OR October 28, 2015. 

 

thank you

7 REPLIES 7
Ned
Alteryx Alumni (Retired)

There are 2 basic ways you can do it.

 

  1. String processing.  Use a Regular Expression or similar formula to extract the part you want.
  2. Date Processing.  Convert it into a standard Alteryx date and the format it back as a string.  This could be done in a single formula tool, or multiple Date tools.

 

Attached is a module that demostrates both techniques. 

s_pichaipillai
12 - Quasar

i would like to To Add on more to Ned's Solution, you can use the formula tool to parse your date and format your date.

 

@ned, i used your workflow and added Formule portion.

 

Alteryx has Many solution for one problem :)

 

@Pvara, you can refer the below Link for datetime pasring 

http://downloads.alteryx.com/Alteryx8.6.2/WebHelp/Reference/DateTimeFunctions.htm

pvara
8 - Asteroid

Thank you the Regex worked however I did get a error when running the Convert Field.

Henrik
6 - Meteoroid

I have a String column in format dd.mm.yyyy and I want to convert that to date datatype. Result: dd.mm.yyyy (Date)

RodL
Alteryx Alumni (Retired)

@Henrik,

The Alteryx date type is always in the configuration YYYY-MM-DD. So if you are wanting to get it into a Date type field to do calculations, filtering, etc. based on it being a Date type, it will need to be converted to that using DateTimeParse (with "%d.%m.%Y" specifiers). 

If you want to maintain your original format for presentation purposes, you could just add a field parsed into a Date type, use that for any calcs or filters, and then unselect it further down the workflow.

 

jasonharper
5 - Atom

Thx... that was helpful.

 

I needed to treat a string formatted like 1995-12 as December of 1995.

 

In the Forumla tool I used:

DateTimeParse([MyDateField], "%YYYY-%mm")

 

and just like that, it worked.

RogerA
8 - Asteroid

@RodL  can i just check, are you saying that the field currently set as string has to be changed to a date/time field before you attempt the date/time parse?

Labels