I have two fields that I'm working with in a table: InTime, and OutTime. These are text fields. Each contain a punch time. For instance: InTime = 14:32, OutTime = 15:01. This is Hours:Minutes. I have to calculate the difference in time between these in an double type format (not the seconds). So in this case it would be .48 as it was 48.3333% of one hour between the two. I have to account for the day changing before the OutTime. Sooo...I have this code:
This has worked in most cases.
What I want to know is: Is there a better way to find the difference in two times?
-I can easily convert these to a date/time field.
-Pete
Code:
dInTime = CInt(Left(rst![InTime], 2)) + CDbl(Format((CInt(Right(rst![InTime], 2)) / 60), "Fixed"))
dOutTime = CInt(Left(rst![OutTime], 2)) + CDbl(Format((CInt(Right(rst![OutTime], 2)) / 60), "Fixed"))
Hours = Hours + IIf(dOutTime > dInTime, dOutTime, dOutTime + 24) - dInTime
What I want to know is: Is there a better way to find the difference in two times?
-I can easily convert these to a date/time field.
-Pete