Alteryx Designer Desktop Discussions

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

Difference Between Time

sgaryali
8 - Asteroid

Hi

I want to subtract punch out from punch in. (Punch out - Punch In)

 

But I only want the time difference.

 

How can we do thiis.

 

Thank you advance.

6 REPLIES 6
grazitti_sapna
17 - Castor

@sgaryali , Here is the workflow to achieve your solution. Let me know if you need any help.

 

Thanks!!

Sapna Gupta
IraWatt
17 - Castor
17 - Castor

Hey @sgaryali,

Here is one way:

IraWatt_0-1662715251145.png

I used the text to column tool to split out the date and then use the date time functions to calculate the diff in minutes.

 

If your interested in learning more about the datetime functions there is a great cheat sheet Blog here: https://community.alteryx.com/t5/Engine-Works/DateTime-Functions-Cheat-Sheet/ba-p/844353

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

sgaryali
8 - Asteroid

Hi @IraWatt  @grazitti_sapna 

 

Thank you for your response.

 

I also though about this formula but One thing I missed to add is that

 

I want output in HH:MM format.

By this I either getting hours, minutes, seconds.

 

How can we do that?

DataNath
17 - Castor

Can tackle this using a single Formula tool with DateTimeParse() and the DateTimeDiff() functions:

 

 

DateTimeDiff(DateTimeParse([Punch-Out],'%d-%b-%Y %H:%M'),DateTimeParse([Punch-In],'%d-%b-%Y %H:%M'),'minute')

 

 

DataNath_0-1662715578450.png

DataNath
17 - Castor

For a HH:MM format you could use something like the following @sgaryali:

 

Padleft(ToString(FLOOR([Minute difference]/60))+':'+ToString(Mod([Minute difference], 60)),5,'0')

 

DataNath_1-1662716006734.png

 

 

grazitti_sapna
17 - Castor

@sgaryali , Always there to help you. You can use formula to get your desired output. Attaching the updated workflow. Please do accept my solution if it helped.

 

Thanks!!

Sapna Gupta
Labels