Connecting Tech Pros Worldwide Help | Site Map

mysql time functions

meltedown
Guest
 
Posts: n/a
#1: Aug 23 '05


This represents 2 fields in a mysql database
[login] => 2005-08-22 18:04:41
[logout] => 2005-08-22 18:05:08

I want to find out the difference between these 2 times.
I don't have access to mysql's DATEDIFF function.

How do I do this ? Its there perhaps, a web page that explains how ?
I have looked at the date and time functions of the mysql manual but i
don't understand it.


Tim Van Wassenhove
Guest
 
Posts: n/a
#2: Aug 23 '05

re: mysql time functions


On 2005-08-22, meltedown <groups2@reenie.org> wrote:[color=blue]
>
>
> This represents 2 fields in a mysql database
> [login] => 2005-08-22 18:04:41
> [logout] => 2005-08-22 18:05:08
>
> I want to find out the difference between these 2 times.
> I don't have access to mysql's DATEDIFF function.[/color]

You could calculate the difference yourself:

SELECT UNIX_TIMESTAMP(logout) - UNIX_TIMESTAMP(login) AS secondsdif


--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
meltedown
Guest
 
Posts: n/a
#3: Aug 23 '05

re: mysql time functions


Tim Van Wassenhove wrote:[color=blue]
> On 2005-08-22, meltedown <groups2@reenie.org> wrote:
>[color=green]
>>
>>This represents 2 fields in a mysql database
>>[login] => 2005-08-22 18:04:41
>>[logout] => 2005-08-22 18:05:08
>>
>>I want to find out the difference between these 2 times.
>>I don't have access to mysql's DATEDIFF function.[/color]
>
>
> You could calculate the difference yourself:
>
> SELECT UNIX_TIMESTAMP(logout) - UNIX_TIMESTAMP(login) AS secondsdif
>
>[/color]
Thanks, that works.
Closed Thread