1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Rep Power

    Time Clock App | How to add up weekly hours?

    My time clock code is good, but I'm having issues with my code for running reports.

    I have a couple loops that 1. grab employee info, then 2. display their punches from date1 to date2 (range). I need to show the total hours for each week.

    I'm doing a big loop through all the punches in a given date range (per user). What's a good way to separate the total hrs for each week? The week could start on a Tue, Wed or end on a Thurs for example.

  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Rep Power
    One of the easiest ways is to group the time based on the start date of the week to which the day belongs. This works well, except at the beginning and ends of the year. There are a lot of different definitions on how to handle week numbers at the beginning and end of a year, so first you need to decide how you're going to handle that.

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo