List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 25 2001 11:05pm
Subject:Re: Any datetime gurus out there?
View as plain text  
At 2:45 PM -0800 11/25/01, Mark Rissmann wrote:
>Hey guys,
>
>Can anybody out there give me a helping hand?
>
>I have a table of the following format
>
>UserId   LoginDate(datetime)      LogoutDate(datetime)
>
>1		2001-11-25 11:00:00	2001-11-25 13:45:00
>2		2001-11-26 22:25:00	2001-11-27 02:00:00
>
>I want to write a query that will calculate the hours worked for each
>record and then sum them up?

Convert each of them to seconds since the epoch (beginning of 1970),
take the difference to get number of seconds worked.  Divide by the
appropriate value, e.g., 60 to get minutes worked.

>
>This is going directly to a report engine so I have little control over
>it (like running multiple queries) except I am able to manipulate the
>final value and format it.
>
>Thanks for any help.
>
>Mark Rissmann

Thread
Using ColdFusion with MySQLSparta Cruz23 Nov
  • Any datetime gurus out there?Mark Rissmann25 Nov
    • Re: Any datetime gurus out there?Paul DuBois25 Nov
RE: Any datetime gurus out there?Mark Rissmann26 Nov