Tools Links Login

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.

Original Author: Sparq

Code




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")

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 102 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.