Alteryx Designer Desktop Discussions

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

Convert 2018-04-12T13:27:48.517Z to EST

ISUGraber
8 - Asteroid

I am pulling dates in through an API and it is coming through formatted as above.  After looking online I believe the "Z" is stating the date is in UTC and the T is simply a barrier between the date and time.  Now what would be the best way to convert this to a date time string in EST?

 

I tried the simple "DateTime" icon converter but I believe the T and Z are confusing it.  

 

I tried creating my own Regex to convert this to a string and then thought I'd use the DateTimeToLocal() command to get to the datetime I want.  Below is my Regex.  Would it be easier to just remove the T and Z, convert to datetime and then datetime local?

(\d{2}-\d{2}-\d{4}T\d{2}:\d{2}:\d{2}.\d{3})

 

4 REPLIES 4
ZacharyM
Alteryx Alumni (Retired)

Using the DateTime tool in Custom mode with the following in the formula should do the trick;

 

yyyy-mm-ddThh:mm:ss

 

You'll still need to convert to local, but to get it in DateTime type, this should work.

 

image.png

 

Cheers!

Zak

ISUGraber
8 - Asteroid

Thank you, that was so much simpler than what I was trying to do!

Karam
8 - Asteroid

You can also use this formula to remove T & Z:

Replace(Replace(YOUR_DATE_TIME, 'T', ' '), 'Z', '')

Select the data type of the output as datetime & convert to your preferred timezone

 

Karam

danilang
19 - Altair
19 - Altair

hi @ISUGraber

 

Once you have the UTC datetime in Alteryx format, you can use the DateTimeToLocal() function, in a formula tool of course, to convert it to your local time zone.

 

Dan

Labels