time registration system

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
headbull
Forum Newbie
Posts: 10
Joined: Thu Jun 07, 2012 7:18 am

time registration system

Post by headbull »

Hi everyone,

Im looking for any good ideas to solve a time/hour registration script. It uses MySQL and PHP (offcourse :mrgreen: )

What shall i Work with ? Timestamps, date and time by it self ? Whats the best way of calculating hours spent (1hr30m or 1,5 hr .... ) ?

Anyone got a good idea ?
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: time registration system

Post by twinedev »

What will you tracking? How precise do you need the tracking (to the second, to the minute, etc)?
headbull
Forum Newbie
Posts: 10
Joined: Thu Jun 07, 2012 7:18 am

Re: time registration system

Post by headbull »

30 minutes/0,5 hrs

Its going to be used for invoicing. I have done most of the system, but when it comes to this time registration module, I dont know where to start and how to work with the time...
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: time registration system

Post by Christopher »

Timestamps, dates and times are all to store data/time values. You are working with durations. I would suggest using minutes rather than hours because you will not get the calculation errors with integers that you might get with floats. Timestamps are in seconds and very easy to do calculations with, so if you want to add/subtract your durations from times then timestamps would make it easy. But keeping durations in seconds is not very readable as data if that's important -- minutes might be better and just multiply times 60 to work with timestamps.
(#10850)
Post Reply