Hours Worked Calculation (1 Viewer)

IanDuk

New member
Local time
Today, 10:55
Joined
Aug 20, 2019
Messages
8
Little help?

I am trying to create a table for entering times worked on a shift system to be calculated in hours.

I have two fields, Start & End, which are formatted to General date so they have the date and time stored.

I have tried the basic calculation End - Start but some shifts finish after midnight.

PLEASE does anyone know the formula that I can enter into the Hours calculated field to get the data I need. I have looked online but can't seem to get the right result.

Many Thanks :)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:55
Joined
Aug 30, 2003
Messages
36,125
How about

http://theaccessweb.com/datetime/date0004.htm

You can also use the DateDiff() function to come up with the lowest required level (minutes or seconds) and compute elapsed time from that.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:55
Joined
May 7, 2009
Messages
19,230
also you can use this function.
it will calculate the correct number of hours even when you past the 24 hours.
Code:
'arnelgp
Public Function HourDiff(dteSmall As Date, dteBig As Date) As Double
    Const OneMinute As Double = 0.0006944444
    Dim tmpDate As Date
    If dteSmall > dteBig Then
        tmpDate = dteSmall
        dteSmall = dteBig
        dteBig = tmpDate
    End If
    HourDiff = Round((CDec(dteBig) - CDec(dteSmall)) / 60 / OneMinute, 2)
End Function
 

Users who are viewing this thread

Top Bottom