Alteryx Designer Desktop Discussions

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

Dropping text and converting to DateTime?

jwlam
8 - Asteroid

Hi everyone!

 

I'm trying to convert a string with time at the beginning into a DateTime field so I can use DateTimeDiff([Left At],[Joined], "minutes") to calculate the difference between when someone joined and left a meeting.

 

The data is always the time followed by am/pm and location (11:00 am San Francisco Time).

What I'm looking for is pulling out 11:00 and dropping the rest.

 

What I've tried is Text to Column to pull out only the 11:00 then Select to change to Time or DateTime. Both don't work in the DateTime tool when trying to convert to 11:00:00 to use the DateTimeDiff formula. It gives me a null value instead after changing the type.

 

When I summarize I get the data to come through

jwlam_0-1654099261282.png

 

But when I use DateTime tool it returns as Null

jwlam_1-1654099303562.png

 

jwlam_0-1654099477785.png

 

4 REPLIES 4
IraWatt
17 - Castor
17 - Castor

Hey @jwlam,

There is a bit to do here. First add two zeros and a ':' before your times and the convert it to a time data type. Then you can use the date time diff function. However you will need to give a date so I just added in 2022-01-1 like in the example attached:

IraWatt_0-1654100163154.png

Any questions or issues please ask :)
HTH!
Ira

 

DataNath
17 - Castor

Can just calculate it from the strings you have parsed if you want to reduce the amount of tools for performance (don't need the DateTimes):

 

DataNath_0-1654100388071.png

 

binuacs
20 - Arcturus

@jwlam One way of dong this with the datetime functions

 

binuacs_1-1654100441849.png

 

 

binuacs_0-1654100613673.png

 

 

jwlam
8 - Asteroid

Thanks everyone! I ended up partially using @DataNath's solution. I parsed out each individual column's information by using DateTimeParse([Column Name], '%I:%M %P').

Labels