Hello,
I'm creating a timeclock and need to calculate total working time in the end of the days. This is what I came up
Is there a better and shorter way to result this?
Thanks!
I'm creating a timeclock and need to calculate total working time in the end of the days. This is what I came up
Code:
fhours = DATEDIFF("h",rs("clockIn"),rs("lunchOut"))
fmins = Right("0" & (DATEDIFF("n",rs("clockIn"),rs("lunchOut")) - DATEDIFF("h",rs("clockIn"),rs("lunchOut"))*60),2)
shours = DATEDIFF("h",rs("lunchIn"),rs("clockOut"))
smins = Right("0" & (DATEDIFF("n",rs("lunchIn"),rs("clockOut")) - DATEDIFF("h",rs("lunchIn"),rs("clockOut"))*60),2)
thours = cint(fhours) + cint(shours)
tmins = cint(fmins) + cint(smins)
if tmins > 60 then
thour = tmins/60
tmins = tmins - (thour*60)
thours = thours + thour
end if
finalresult = thours&":"&Right("0" & (tmins),2)
Is there a better and shorter way to result this?
Thanks!