SELECT trouble with DIFFTIME

I want to know the time difference between two dates. for example:

    SELECT TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00');
+-------------------------------------------------------+
| TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00') |
+-------------------------------------------------------+
| 219:00:00                                             |
+-------------------------------------------------------+
1 row in set (0.00 sec)

Now i want to extract the hours.

mysql> SELECT HOUR(SELECT TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00'));
ERROR 1064 (42000): 

Why doesn't work?

Answers


Try:

SELECT HOUR(TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00'));

This could resolve your problem:

SELECT TIME_FORMAT(TIMEDIFF('2012-12-19 22:00:00','2012-12-10 19:00:00'),'%H');

Need Your Help

Audio tag progress bar standing on right

firefox html5-audio

I'm having an issue with audio tag and Firefox. I am using the default browsers' controls. It works fine with Chrome and Opera, but in Firefox progress bar stays on right(like it was the end of the

Node icon in a jsTree tree with font-awesome

xml xslt jstree font-awesome

I have a tree structure using jsTree, like this: