On Wednesday 05 December 2001 16:40, you wrote:
> hi everybody
> i want to take diff of datetime format columns.
> Is it possible using direct '-' arithmatic..
> It gives result as:
>
> 2001-11-03 15:43:47 - 2001-11-03 15:42:21 = 126
> 2001-11-03 16:11:50 - 2001-11-03 15:48:00 = 6350
>
> First row is clear but i'm not getting second row's
> diff.. **((63)50)** how it comes.
>
> Is there any diff way to find diff of datetime
> columns. (any mysql func.)
>   OR
> It is not possible by using any standard mysql
> funcions and one has to write his own program to do
> this.

You can use something like this:

SEC_TO_TIME(UNIX_TIMESTAMP("2001-11-03 16:11:50") - 
UNIX_TIMESTAMP("2001-11-03 15:48:00"))

which would return

 00:23:50

hth
-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Universe, n.:
        The problem.
*/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to