List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 17 2002 11:35pm
Subject:Re: Calculating time fields
View as plain text  
At 16:23 -0700 8/17/02, Todd Schacherl wrote:
>Hi Folks,
>
>I have a MYSQL table with timeIn and a timeOut columns and I'm trying to
>figure
>out if I can calculate the difference within a SELECT statement.  Both
>fields are type TIME (e.g., 00:00:00).

What units do you want the result in?  To get the difference in seconds,
use:

TIME_TO_SEC(timeOut) - TIME_TO_SEC(timeIn)

If you want the difference as a TIME, pass that result to SEC_TO_TIME().

>Thanks,
>
>Todd Schacherl
>zoneone@stripped
>
>One of the penalties for refusing to participate in politics is that you end
>up being governed by your inferiors. -Plato

Thread
Calculating time fieldsTodd Schacherl18 Aug
  • Re: Calculating time fieldsPaul DuBois18 Aug