Re: [PHP] Date/time format?
- From: lists@xxxxxxxxx (Jim Lucas)
- Date: Thu, 29 Mar 2007 15:12:44 -0700
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
.
- References:
- Re: [PHP] Date/time format?
- From: Roberto Mansfield
- Re: [PHP] Date/time format?
- Prev by Date: Re: [PHP] Link to download files on another part of system
- Next by Date: Re: [PHP] Date/time format?
- Previous by thread: Re: [PHP] Date/time format?
- Next by thread: Re: [PHP] Date/time format?
- Index(es):
Relevant Pages
|