Hello again....

Here's my problem: In my time calculations, I'm taking the time that
the user clocked out, minus the time they clocked in. I'm using the
time_to_sec function in mysql. I work very odd hours. If I clock in
say at 10pm, then clock out at 1am, the clock is majorly messed up. I
think it's because it's a new day. I thought that the time_to_sec
functon turned the time into seconds from 1980 or something like that,
so the date and time when returning to the function should be right...


Or maybe it's because it's returning the new time, and not the new
date?

I think I just answered my own question....

          $cisecs = mysql_query("SELECT TIME_TO_SEC('$citime')");
          $cisecs = mysql_fetch_array($cisecs);
          $cosecs = mysql_query("SELECT TIME_TO_SEC('$cotime')");
          $cosecs = mysql_fetch_array($cosecs);

          if (($cisecs[0] != 0) && ($cosecs[0] != 0) && ($getnopay ==
false))
          {
            $timeresult = $cosecs[0] - $cisecs[0];

            $totaltime = mysql_query("SELECT
SEC_TO_TIME($timeresult)");
            $totaltime = mysql_fetch_array($totaltime);
          }
          else
          {
            $timeresult = 0;

            $totaltime = mysql_query("SELECT
SEC_TO_TIME($timeresult)");
            $totaltime = mysql_fetch_array($totaltime);
          }

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com

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

Reply via email to