Re: Date/time format?

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

 



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 |

the minutes column is the number of minutes that have passed since midnight. the sequence number refers to the sequence that the times were entered, meaning that 480 minutes after midnight came before 720 minutes, which was before 750 minutes which was before 990 minutes. What I need to do, is be able to calculate the time between 0 & 1, 2 & 3, 4 & 5 (there is a total of 6 sequences that could be in here)

here is now the math would like on that particular entry: (480-720) + (750-990)=480/60=8 hours.

This is a timecard program that I'm trying to write a report for to show the time for the entire month instead of it's default for the week. You can see what I have tried live at: raoset.com/tests/ oatstest/oats.shtml

the code that I need help with is the math. I have looked but I just can't find a clear way to get the info from mysql, into an array in php to do the math? Maybe I've been looking at it to long and so I'm missing easy stuff?

I have tried this code:
$querytime = mysql_query("select sum(minutes) as t1, sum(sequence) as t2 from oats_time");
while($row = mysql_fetch_array($querytime)){
$fulltotal=$row['t1']+$row['t2'];
echo($fulltotal);
}
 but that didn't work the way I wanted it to.

Anyway... Post is long enough to start, so let me know if there is other info you need.

Thanks in advance!

--

Jason Pruim
japruim@xxxxxxxxxx
Production & Technology Manager
MQC Specialist (2005 certified)
3251 132nd Ave
Holland MI 49424
616.399.2355
www.raoset.com


"America will never be destroyed from the outside. If we falter and lose
our freedoms, it will be because we destroyed ourselves."
 -Abraham Lincoln


Attachment: smime.p7s
Description: S/MIME cryptographic signature


[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