Re: Date/time format?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux