We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Convert an AM integer or string to time hh:mm

nwiseman37
5 - Atom

I have time stamps like 620 and 1545 that i need to convert to 06:20:00 and 15:45:00

I changed the data type to an integer then used parse string to date & time with input hhmm

 

It works for 10am onwards but anything before that returns null

i.e. 620 should be 06:20:00 or 06:20 AM but I get null----any ideas on how to fix that?

3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

Hi @nwiseman37 

 

Try adding in a PadLeft() function. This will help any of the 3 digit times have a 0 tacked on to the front. 

 

datetimeparse(padleft(tostring([Time]),4,'0'),'%H%M')

 

Luke_C_0-1650405251601.png

 

 

SPetrie
13 - Pulsar

leave it as a string and add a 0 to the beginning if its less than 4 characters long. You can parse the time after that.

DateTimeParse(padleft([time],4,"0"),"%H%M")

SPetrie_0-1650405279434.png

 

nwiseman37
5 - Atom

perfect! thank you

Labels
Top Solution Authors