Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

Convert Integer to Time

RSchomer
7 - Meteor

I have a field of values which is given to me as integers.  The problem I have is that the data is actually time.  I need a way to convert the integers to time format.  The data looks similar to below:

700

1559

15

935

 

 

My desire is to convert the time (either by formula or some other tool) to time as shown below:

7:00
15:59
0:15
9:35

 

The time is 24 hour clock and the returned integer will never exceed 4 digits.  I am using Alteryx 10.6.

4 REPLIES 4
JohnJPS
15 - Aurora

Hi @RSchomer

Will the following work:

PadLeft(
  Left([fld],Length([fld])-2) + ":" + Right([fld],2)
  ,5,"0")

You will first need to use "Select" to change the type to a string type of sufficient length.

RSchomer
7 - Meteor

That works pretty good.  However, the formula returns a string.  How do I convert that string to time format, so that I can use the DateTimeAdd and DateTimeDiff formulas?

DanS
9 - Comet

The DateTime tool should work under Parse. 

 

It should be able to convert to HH:mm:ss  which will work with DateTimeAdd() and Diff()

 

thanks,

Dan

RSchomer
7 - Meteor

That's the info I needed.  Thanks to both of you.

Labels