Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   MySQL Time Difference BUG (http://www.go4expert.com/forums/mysql-time-difference-bug-t16183/)

cancer10 14Feb2009 11:21

MySQL Time Difference BUG
 
Hi

Not sure if this is a bug or not.


I am doing a sql query for time difference using the TIMEDIFF function.

It works for all other but not when not when you are doing a time difference for start time 23:00:00 (11 PM night) and end time 00:30:00 (12 AM Midnight)

if you take a look, the difference is 1.5 hours, but the sql tells me that the difference is 22 hours, 30 minutes



Any solution to this?

Thanx

shabbir 14Feb2009 11:43

Re: MySQL Time Difference BUG
 
That means it takes the date into account and assumes the same day.

pradeep 30May2009 15:03

Re: MySQL Time Difference BUG
 
Logically what MySQL returns is correct, 00 hr onwards is next day, so you must include the date part!

Code: SQL

SELECT timediff('2009-05-28 11:30:00','2009-05-28 00:30:00')


Outputs:
Code:

11:00:00


All times are GMT +5.5. The time now is 19:27.