219
Views
5
Comments
Getting the dates differences in DD:MM:HH:SS
Question

How do i find out the lapsed time between two date time?

Created date time: 00:40:30

Response time: 00:00:01:36   ==> How can i get this value?

Job started: 00:42:06

2016-04-22 00-29-45
Nuno Reis
 
MVP

You can use functions like DiffHours/DiffMinutes/DiffSeconds to get time difference between dates.

Attention that each one will return the total, so in this scenario

DiffMinutes=1 and DiffSeconds=96 (60+36)

But you can add the seconds to a NullDate to get the time since Start and then cast DateTime to Time to have only the hh:mm:ss bit.

DateTimeToTime(AddSeconds(NullDate(),DiffSeconds(StartDateTime,EndDateTime)))


If your difference is over 24h, you can use DiffDays to get the days portion.

2019-01-31 08-54-57
André Costa
Champion

I think the exact solution for your problem is this:

DiffDays(DateTime1,DateTime2) + ":" +

Mod((DiffHours(DateTime1,DateTime2)),24) + ":" + 

Mod((DiffMinutes(DateTime1,DateTime2)),60) + ":" + 

Mod((DiffSeconds(DateTime1,DateTime2)),60)


As Nuno Reis mentioned, you can use DiffDays/DiffHours/DiffMinutes/DiffSeconds to calculate the difference between dates.

With the assist of Mod function, you can build your expression as described above.

Hope it solves your problem.



2025-07-22 10-30-27
Mandar Deshpande

This worked. Thanks.

2016-04-22 00-29-45
Nuno Reis
 
MVP

It is possible, but maybe ":" is not the best separator between days and hours. That's why I left on the side.

This seemed a "how long my timer took?" question.

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