-
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
-
-
No it isn't. 23 - ½ = 22½. Your arithmetic is clearly off, and I suspect you got the arguments the wrong way around — if you'd performed the operation as you describe, you would have got back -22:30:00.
If you meant the times to be on different days then you have to say so, and use TIMESTAMPDIFF(). Request the difference in seconds, then use SEC_TO_TIME() to convert it back into a TIME if it is a TIME you need. However, be aware that this is a truncating operation: any value greater than a day will be truncated, and a warning generated.
If you think it's a bug, it probably isn't. Don't go declaring every surprise a bug — developers generally don't like the implication that you know their software better than they do.
Last edited by Twey; 02-14-2009 at 11:01 AM.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks