Alteryx designer Discussions

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

cannot get a string to convert correctly to a date

Asteroid

Hi,

 

I have a specific date formatted string that I would like to convert to a date but when passing this into the parse datetime tool I am getting some incorrect results.  The format of the date is yyyy-mm-ddThh:mm:ssZ and I have this in as a custom format in the tool.

See the workflow below for an example where 2019-03-15T10:06:50Z gets converted to 2019-01-15 10:06:50

 

 

Highlighted
Comet

For month you need to use MM instead of mm (lowercase = minutes). It looks to me like if I change your custom format to yyyy-MM-ddThh:mm:ssZ in your workflow I get the right output date (2019-03-15)

Highlighted
Castor
Castor

Hi there @craigja 

 

Your custom format string should be "yyyy-MM-ddThh:mm:ssZ" and not "yyyy-mm-ddThh:mm:ssZ"  "MM" is the specifier for months

 

Dan

Highlighted
Quasar

perhaps I'm missing something here, but the simpler route (at least in my mind) would be to use a formula tool to create a new field formatted as a Date (not datetime) with the formula

 

datetimeparse([field],"%y-%m-%dT%H;%M:%SZ")

there's no need to trim the field or do any other actions.

Highlighted
Asteroid

Thanks folks - that was indeed the problem, the lower case mm!

Labels