Consulting

Results 1 to 5 of 5

Thread: calculating total time on a timesheet.

  1. #1

    calculating total time on a timesheet.

    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.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,531
    Location
    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 \
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Quote Originally Posted by SamT View Post
    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.

  4. #4
    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 while I was studying. It was perfect for me because I had to attend classes too.
    Last edited by LiamLambert; 04-13-2021 at 12:47 PM.

  5. #5
    Quote Originally Posted by LiamLambert View Post
    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 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •