Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Subtract time (maintain format)

EL1988
6 - Meteoroid

Hi all,

 

I am trying to create a new output column that is the difference between the start and end time columns. 

 

I tried using the DateTimeDiff formula, but was not sure about what to input as the 3rd argument for it to return the information in the same hh:mm:ss format.

 

DateTimeDiff([Start time], [End time], ???)

 

Start timeEnd timeOutput
8:57:329:05:450:08:13
9:05:4510:07:111:01:26
6 REPLIES 6
AngelosPachis
16 - Nebula

Hi @EL1988 ,

 

Here's how I would approach it. I would first find the total difference in seconds and then start to form each element of your date diff individually, i.e. difference in hours, then minutes and finally diff in seconds again.

 

AngelosPachis_0-1634561835426.png

Hope that helps,

Angelos

EL1988
6 - Meteoroid

Hi Angelos, thanks for offering that as a solution. The proposed solution returns the output as a string, but I would like to maintain the output in a time format.

Christina_H
14 - Magnetar

@EL1988 You can update the data type in the select tool to convert it to a time.  Alternatively, this thread has a good formula to convert a number of seconds into time format, so use a DateTimeDiff formula followed by that.

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Converting-seconds-to-hh-mm-ss/td-p/31...

AngelosPachis
16 - Nebula

@EL1988 , like @Christina_H suggested, you can change the output to be of a Time format in the select tool 🙂

DawnDuong
13 - Pulsar
13 - Pulsar

hi @EL1988 

You can add a Datetime Tool right at the end of the workflow @AngelosPachis has done.

Datetime.PNG

And select the format "HH:mm:ss:

Dawn.

EL1988
6 - Meteoroid

Much appreciated, thanks all for your valuable inputs!

Labels