Alteryx Designer Desktop Discussions

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

How to convert String values to Time format ? (75 into 01:15:00)

AbhirupMukherjee09
7 - Meteor

Hi,

My input data is 

10

20

60

75

I want the output to be 

00:10:00

00:20:00

01:00:00

01:15:00 

How can I get this output ? 

DateTimeParse([field],"%M") is not working for values 60,75 etc 

5 REPLIES 5
DavidSkaife
13 - Pulsar

Hi @AbhirupMukherjee09 

 

There is probably a more elegent way but this seems to work using the ToDateTime formula and divide your input by the number of minutes in a day:

DavidSkaife_0-1667227208018.png

 

Edit: forgot to wrap the input in a ToNumber() formula as you said it was a string input

 

DataNath
17 - Castor

Can handle this in a similar way to your previous post, by adding [Input] amount of minutes to a dummy date and just outputting the Time element:

 

DataNath_0-1667226500719.png

 

If your minutes field is a string, just need to wrap it in ToNumber() within the expression, so in my case it would be:

 

DateTimeAdd('1900-01-01',ToNumber([Input]),'minute')

IraWatt
17 - Castor
17 - Castor

Hey @AbhirupMukherjee09.

Here is one approch you can use:

IraWatt_0-1667226459469.png

Essentially just calculate the hours and mins first then pass that to the parse function.

 

The community has some quick and easy videos on formulas and the Formula Tool here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Writing%20...

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

Luke_C
17 - Castor

Hi @AbhirupMukherjee09 

 

Here's one way:

Luke_C_0-1667226645293.png

 

 

Felipe_Ribeir0
16 - Nebula

Hi @AbhirupMukherjee09 

 

If you have just minutes between 0 minutes - 1440 minutes (one day) range, this is a way of using the native DateTimeAdd function without any more complex calculations:

 

Felipe_Ribeir0_0-1667226652529.png

 

Labels