
August 3rd, 2004, 05:40 AM
|
|
Contributing User
|
|
Join Date: Mar 2004
Posts: 82
Time spent in forums: 1 h 30 m 28 sec
Reputation Power: 5
|
|
|
Date and time are double numbers where the date is the integer and time is the fraction. Convert the begin date and time separately and add them together and do the same with the end date and time. Subtract the Begin date/time from the End Date/time and you get the difference which can be reconverted to date and time format.
I am enclosing a simple function to test
date and time values.
Private Function fnDateAsDoubleTest()
Dim varDate As Variant, varTime As Variant
varDate = Date: varTime = "08:02 AM"
dblDateAndTime = CDbl(varDate) + Format(CDbl(CDate(varTime)), "#.######")
Debug.Print Format(CDbl(CDate(varTime)), "#.######")
Debug.Print varDate
Debug.Print CDbl(varDate)
Debug.Print dblDateAndTime
End Function
I hope this helps.
|