View Full Version : TimeclockTimeperiod Listing

Ted Varnson
06-02-2006, 03:09 PM
I' creating a timecard, and I am at the point where I am coding the reports. So what I am trying to set up is for a list of all the payperiods Employee X has worked.

For example:

Each payperiod begins on Friday and ends on Thurday. So:

Employee X starts working on May 18 (a Thursday) and is still working in the present, so in theory the script would print the report like this:

05/12/06 - 05/18/06
05/19/06 - 05/25/06
05/26/06 - 06/01/06
06/02/06 - 06/08/06

Where every payperiod that has AT LEAST one day worked is displayed. (starts displaying upon first day of work and stops displaying when it reaches the current time. - ie: doesn't show every payperiod for '06 right off the bat)

The idea behind it of course is to lead to being able to click into a certain payperiod and see the individual days worked in order to make edits and so forth.

Any help is appreciated. :D

06-02-2006, 03:14 PM
Hrmmm, not 100% sure exactly what you are wanting, but have a look at PHP's date (http://php.net/date) and mktime (http://php.net/mktime) functions.


Ted Varnson
06-05-2006, 02:25 PM
Hi, thanks for the reply. To answer, no its not a question of formatting the time, what I'm asking is how I can get PHP to generate dynamic links starting with the begining of the payperiod and ended with the end of the payperiod.

For example: We'll say the payperiod is 1 week long, and starts on a June 1 and ends on June 5.

So now we have the payperiod established. Now lets say Employee A has worked with the company for 3 weeks.

How can I get PHP to generate the three payperods Employee A has worked?

It would generate something to this effect:

Payperiods for Employee A:
June 05 - June 09 (#)
June 12 - June 16 (#)
June 19 - June 23 (#)

I hope this is easier to understand. :D