Connecting Tech Pros Worldwide Help | Site Map

mysql time functions

  #1  
Old August 23rd, 2005, 01:05 AM
meltedown
Guest
 
Posts: n/a


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.


  #2  
Old August 23rd, 2005, 01:35 AM
Tim Van Wassenhove
Guest
 
Posts: n/a

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>
  #3  
Old August 23rd, 2005, 01:45 AM
meltedown
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Php Scripting : Mysql Time format and PHP Calc based on opening hours in database daknightuk answers 2 January 3rd, 2008 11:36 PM
Converting MySQL dates Tgone answers 3 September 1st, 2006 11:05 PM
converting ms access database to mysql 5 database Dan Lewis answers 4 March 14th, 2006 09:55 PM
MySQL, time() and usinx dates Unix Style Sims answers 20 July 17th, 2005 09:22 AM