PDA

View Full Version : [SOLVED:] calculating total time on a timesheet.



DBinPhilly
02-21-2018, 03:01 PM
I need to calculate total time worked in a period with multiple work days. For each workday I have a start time and a finish time. I have no problem if the time worked is an exact # of hours. But if there should be a fraction of an hour in the total, it is truncated.

I'm using the following calcs to arrive at the daily time worked:

If StartTime > FinishTime Then
myFinish = FinishTime + 1
Else
myFinish = FinishTime
End If
MyHours = DateDiff("h", StartTime, myFinish)

StartTime and FinishTime are provided from input data. Again this function works fine if the time is an even hour. Otherwise, no go.

SamT
02-21-2018, 03:37 PM
MyTime = DateDiff("n", StartTime, myFinish) 'In minutes
'Return Hours and minutes
MyHours = MyTime\60 'Note \ vs /
MyMins = MyTime Mod 60

'Return decimal hours
MyHours = MyTime/60 'Note / vs \

DBinPhilly
02-21-2018, 03:51 PM
MyTime = DateDiff("n", StartTime, myFinish) 'In minutes
'Return Hours and minutes
MyHours = MyTime\60 'Note \ vs /
MyMins = MyTime Mod 60

'Return decimal hours
MyHours = MyTime/60 'Note / vs \


The wizard of Access strikes again. Worked right the first time. Thanks.

LiamLambert
04-13-2021, 12:32 PM
Usage of swing shifts might help you. A lot of businesses use swing shifts to rotate their roster. Employers use swing shifts to keep up with work when it's too busy. This might be good for the employees too because it might give them more time for their personal things. The disadvantage of swing shifts might be creating the schedule. It is too much you have to plan, and it's hard because people are coming and going all the time. It has its good and bad sides. I worked a swing shift (https://tracktime24.com/Blog/what-is-a-swing-shift) while I was studying. It was perfect for me because I had to attend classes too.

DBinPhilly
04-13-2021, 01:12 PM
Usage of swing shifts might help you. A lot of businesses use swing shifts to rotate their roster. Employers use swing shifts to keep up with work when it's too busy. This might be good for the employees too because it might give them more time for their personal things. The disadvantage of swing shifts might be creating the schedule. It is too much you have to plan, and it's hard because people are coming and going all the time. It has its good and bad sides. I worked a swing shift (https://tracktime24.com/Blog/what-is-a-swing-shift) while I was studying. It was perfect for me because I had to attend classes too.
Too late, the company is going out of business. Founded in the 1824.