Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here are the components needed to calculate the days, hours, minutes,
and seconds between two dates... Private Sub Difference() Dim tStart As Date, tEnd As Date Dim sTime As String, sDays As String Dim sHours As String, sMin As String, sSec As String tStart = Now - 0.12 tEnd = Now sTime = DateDiff("s", tStart, tEnd) sDays = ((((sTime / 60) / 60) / 24) Mod 60) sHours = ((sTime / 60) / 60) Mod 24 sMin = (sTime / 60) Mod 60 sSec = sTime Mod 60 End Sub tStart and tEnd are only in there to provide a couple of date values to test the sub with. You can easily modify this to pass in a start and end date like so: Private Sub Difference(tStart As Date, tEnd As Date) and then delete the three lines: Dim tStart As Date, tEnd As Date ........ tStart = Now - 0.12 tEnd = Now Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculating total elapsed minutes between two dates | Excel Discussion (Misc queries) | |||
Calculating Elapsed Time | Excel Worksheet Functions | |||
Calculating elapsed time | Excel Discussion (Misc queries) | |||
Calculating Time elapsed | Excel Worksheet Functions | |||
Calculating elapsed time | Excel Worksheet Functions |