Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

convert string field to DateTime field

I'm new to Alteryx and I have a field that comes in as a String in this format 1/15/2018 8:00 and I need to convert it to a DateTime with this format  2018-01-15 06:00:00.  I tried this DateTimeParse([CRTE_TS],"%Y-%m-%d %I:%M") but it returns a NULL.  Does anyone have suggestions on what I should do?

Alteryx Certified Partner

I'd suggest: DateTimeParse([CRTE_TS],"%m/%d/%Y %H:%M")

  1. In DateTimeParse() you're specifying the incoming data format, not the outgoing data format.
  2. I believe if you want to use %I to specify a 12 hour, rather than a 24 hour clock, you'll need to also have an AM/PM indicator (%P) in the data.


I'd also suggest you consider the DataTime Tool as that would altogether eliminate the need to code up a DateTimeParse() expression.