Re: Date/time format?

From: Date: Thu, 29 Mar 2007 22:12:44 +0000
Subject: Re: Date/time format?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-251702@lists.php.net to get a copy of this message
Roberto Mansfield wrote:
Jason Pruim wrote:
Thanks everyone for your suggestions, it turns out it was a unix time stamp and I can get it to parse out a normal date now. Now... on to the harder part.... What I am trying to do is learn... This is kind of just a pet project for me to figure out how I can do it. here is how the database is laid out: +-----------+------------+---------------------------------+---------+----------+
| user      | day                |
job_name                                 | minutes | sequence |
+-----------+------------+---------------------------------+---------+----------+
| root      | 1172466000 | Production & technology Manager |     480
|        0 |
| root      | 1172466000 | Production & technology Manager |     720
|        1 |
| root      | 1172466000 | Production & technology Manager |     750
|        2 |
| root      | 1172466000 | Production & technology Manager |     990
|        3 |
Your table has different types of records in it -- clock in, and clock out. You are using order to assume which record is a start time and which is an end time. This is very vague. Also what happens if you are working late past midnight or someone forgets to clock out? I think a better approach would be to have a "clock in" field (timestamp) and a "clock out" field (another timestamp). That will simplify things considerably. You can then calculate your time totals with math on each record instead of across records: select (clock_out - clock_in)/3600 AS hours_worked from table ... Or: select sum((...)) etc.
He doesn't have the option of changing this, it is a pre existing system. He is just trying to add a feature. -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush

« previous php.general (#251702) next »