I am using the below code to show the date difference in Day:Hour:Minute format.
Function TimeSpan(dt1, dt2)
Dim seconds,minutes,hours,days
If (isDat
Be aware I'm more used to write VBA, so you might need to tweak here and there.
Alternatively you could just subtract the two dates from eachother as numerical value:
Dim dblDateDiff as Double
dblDateDiff = Abs(dt2 - dt1)
Now the Timespan would be (dont use "d" as that would not include months and years that could have passed):
Timespan = Int(dblDateDiff) & ":" & Hour(dblDateDiff) & ":" & Minute(dblDateDiff)
If the direction (positive or negative) of the Timespan is relevant you could change the last line into:
Timespan = Sgn(dblDateDiff) * Int(dblDateDiff) & ":" & Hour(dblDateDiff) & ":" & Minute(dblDateDiff)
For your time formatting issue either:
Add a single quote in front of the rest of the string:
Timespan = "'" & Sgn(dblDateDiff) * Int(dblDateDiff) & ":" & Hour(dblDateDiff) & ":" & Minute(dblDateDiff)