Page 1 of 1

time differecne

Posted: Sat Mar 10, 2007 5:22 am
by itsmani1
how can i find exact time difference between current time and given time.

I tried both with php code and mysql statement

for exampel this qry:

Code: Select all

SELECT TIMEDIFF(CURDATE(),'2009:01:01 00:00:00');
gives me null

Posted: Sat Mar 10, 2007 5:32 am
by volka
Format of the "given date"?
What have you tried so far?

Posted: Sat Mar 10, 2007 5:33 am
by itsmani1

Code: Select all

SELECT TIMEDIFF(CURDATE(),'2009:01:01 00:00:00');
should this give NULL?

Posted: Sat Mar 10, 2007 6:04 am
by volka

Posted: Sat Mar 10, 2007 7:22 am
by feyd
This isn't even remotely a PHP question.

Shape up itsmani1; you've been here long enough.

Posted: Sat Mar 10, 2007 12:25 pm
by arukomp
Try this:

Code: Select all

SELECT TIMEDIFF(CURDATE(),'2009-01-01 00:00:00');
You have to use '-' in date and ':' in time. The date format was wrong, so it gave you a NULL