Mega Code Archive

 
Categories / MySQL Tutorial / Date Time Functions
 

HOUR(time) returns the hour for time

The range of the return value is 0 to 23. The range of TIME values could be much larger. mysql> mysql> SELECT HOUR('10:05:03'); +------------------+ | HOUR('10:05:03') | +------------------+ |               10 | +------------------+ 1 row in set (0.00 sec) mysql> mysql> SELECT HOUR('272:59:59'); +-------------------+ | HOUR('272:59:59') | +-------------------+ |               272 | +-------------------+ 1 row in set (0.00 sec)