Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

cannot get a string to convert correctly to a date

craigja
8 - 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

 

 

4 REPLIES 4
adamorse
9 - 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)

danilang
19 - Altair
19 - Altair

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

neilgallen
12 - 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.

craigja
8 - Asteroid

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

Labels