42
Views
6
Solved
###### TIME DIFFERENCE FUNCTION
Question

I have a start time (HH:MM:SS) and an end time (HH:MM:SS)

I would like to subtract the start time from the end time but i am failing How can i subtract all 3 (HH:MM:SS) at once

i tried DiffHours (EndTime, StartTime) + ":"+ DiffMinutes (EndTime, StartTime)+ ":"+ DiffSeconds (EndTime, StartTime) but it calculates wrongly

Solution

Hi Rudo,

you could do it like this

`AddSeconds(NewTime(0,0,0),DiffSeconds(StartTime,EndTime))`

Dorine

RUDO MURIEL MUNYAVI wrote:

I have a start time (HH:MM:SS) and an end time (HH:MM:SS)

I would like to subtract the start time from the end time but i am failing How can i subtract all 3 (HH:MM:SS) at once

i tried DiffHours (EndTime, StartTime) + ":"+ DiffMinutes (EndTime, StartTime)+ ":"+ DiffSeconds (EndTime, StartTime) but it calculates wrongly

Hi Rudo,

You should use this functions like this:

DiffHours(StartTime, EndTime)

Thanks

Hi Rudo,

Rajat's answer is correct, I would like to add on that, you shall use DiffHours (StartTime, EndTime) + ":"+ DiffMinutes (StartTime, EndTime)+ ":"+ DiffSeconds (StartTime, EndTime) . Morever, you can get examples for every in-built function inside expression if you just click on the function, like below :

Hope it helps!

Thanks,

Sanjay

MVP

Hi RUDO,

You need to use this function for give diff from hours

`NewTime(DiffMinutes(EndTime,StartTime)/60,Mod(EndTime,StartTime),60), NullIdentifier())`

Same concept use for second

Regards

Rahul Sahu

MVP

Hi,

To add to what is suggested about, I want to point out that one needs to be aware that with DiffSeconds, and DiffMinutes and DiffHours there are limitations (as stated in the documentation) on the max difference that can be calculated.

DiffHours max difference is 244978.74 years

DiffMinutes max difference is 4085.78 years

DiffSeconds max difference is 68.10 years

As you see using only DiffSeconds could be a  would quickly lead to unexpected result.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi,

To add to what is suggested about, I want to point out that one needs to be aware that with DiffSeconds, and DiffMinutes and DiffHours there are limitations (as stated in the documentation) on the max difference that can be calculated.

DiffHours max difference is 244978.74 years

DiffMinutes max difference is 4085.78 years

DiffSeconds max difference is 68.10 years

As you see using only DiffSeconds could be a  would quickly lead to unexpected result.

Regards,

Daniel

Great addition Daniel, I didn't know that.

As OP was talking about building her own timer on some other post, I think she doesn't have to worry, though.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.