Jump to content


Photo

PHP Time Calculation


  • Please log in to reply
3 replies to this topic

#1 whsjr86

whsjr86
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 March 2006 - 10:49 PM

I want to make a script that takes the time a person started a task and the time finished and then stores both start and stop time and calculates the total that is rounded to the nearest hour.

#2 php_b34st

php_b34st
  • Members
  • PipPipPip
  • Advanced Member
  • 168 posts

Posted 05 March 2006 - 11:01 PM

What have you got so far? have you got any code we can work around?

#3 whsjr86

whsjr86
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 March 2006 - 11:38 PM

No I do not have any code I have written so far. This is an idea a friend and I came up with for an event we're running at our college and I'm a php noobie, so I was looking here for some help. Any kind of contribution would be greatly appreciated.

#4 js_280

js_280
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 06 March 2006 - 04:50 PM

I created a simple timeclock system awhile back that I can get you the code for tonight. Basically I just built a MySQL table that held user info, such as username/password/department/etc. Then I built a table that stored an auto_ID, employee_ID which referenced the user table, timestamp column, a column for whether it was a clock in or clock out (0 or 1) and a column for calculated time worked. I think all I did was have two links (one for clock-in, one for clock-out) that access a script checking the last entry for that employee and if they were trying to clock in and it already showed them logged in, it would pass them back with an error message saying that they had already logged in, else it would record the timestamp. When they clocked out, it checked to ensure that they weren't already clocked out, and if not, store the timestamp and calculate the time worked. The admin panel pulled the sum of the time worked for the employee, and period specified. You could also include a column in the employee table for payrate and calculate the employees check taking into account overtime.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users