Skip navigation links

MySQL Forums :: PHP :: How to calculate time difference


Advanced Search

How to calculate time difference
Posted by: janakiraman t ()
Date: November 01, 2006 01:42AM

Hi,

I have a column called timeinterval which is of type datetime. I need to select the first and the second timeinterval and find the difference between them. if it is greater than 30 seconds i need to do something. how to achieve this. I tried using datediff and timediff.

eg:
select TIMEDIFF ('2006-10-31 11:50:31' , '2006-10-31 11:50:01')
eg:
select DATEDIFF ('2006-10-31 11:50:31' , '2006-10-31 11:50:01')

but it is saying you have an error in sql syntax. Iam using mysql 4.1.0 version.

one more thing. If the query works fine how can i check whether it is greater than 30 seconds. If suppose it is greater than one day it is going to return 1. How to check this condition also.


Thanks
jankiraman

Options: ReplyQuote


Subject Written By Posted
How to calculate time difference janakiraman t 11/01/2006 01:42AM
Re: How to calculate time difference Felix Geerinckx 11/02/2006 09:45AM
Re: How to calculate time difference d d 11/19/2008 01:00AM
Re: How to calculate time difference bijoy thomas 03/11/2007 01:48AM
Re: How to calculate time difference mahima vyas 04/03/2007 06:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.