Re: [PHP] Date/time format?



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
.



Relevant Pages

  • Re: [PHP] Date/time format?
    ... stamp and I can get it to parse out a normal date now. ... Your table has different types of records in it -- clock in, ... and a "clock out" field (another timestamp). ...
    (php.general)
  • Re: Windows clock update frequency
    ... When using NTP, the clock may gap forward or backward. ... The resolution of the timestamp you are looking for is on the same ...
    (microsoft.public.development.device.drivers)
  • Re: CONFIG_SLOW_TIMESTAMPS was Re: ANNOUNCE: CE Linux Forum - Specification V1.0 draft
    ... > network guys that do_gettimeofday has too much overhead for their ... take a timestamp unless you really need it. ... clock access for the timestamp on some systems. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Pause and resume AVI capture (an old chestnut )
    ... Heres my fillbuffer logic... ... Wait until its time to render the new frame (using Advisetime for ... Timestamp with currenttime from a internal clock (I have a private ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: TimeStamp
    ... Are you sure the clock wasn't set in between? ... time the request was received by the server if in a mode 4 packet. ... Subject: TimeStamp ... Time Stamp is: Jan 1, 1970 00:21:26.0827 UTC the Transmit Time Stamp is ...
    (comp.protocols.time.ntp)