- Home
·
- Math/Dates
·
- Get Hours, Minutes, AND Seconds between 2 Dates (or of total seconds)
Get Hours, Minutes, AND Seconds between 2 Dates (or of total seconds)
This code will enable you to take two dates, find the total seconds in between them, and calculate the Hours, Minutes, and Seconds.
Rate Get Hours, Minutes, AND Seconds between 2 Dates (or of total seconds)
(4(4 Vote))
Dim H, M, S, Secs as Long
Secs = DateDiff("s", Date1, Date2)
H = Int(Secs / 3600)
Secs = Secs - (H * 3600)
M = Int(Secs / 60)
Secs = Secs - (M * 60)
S = Secs
MsgBox Format(H, "00") & ":" & _
Format(M, "00") & ":" & _
Format(S, "00")
Get Hours, Minutes, AND Seconds between 2 Dates (or of total seconds) Comments
No comments yet — be the first to post one!
Post a Comment