HOUR() extracts the hour component from a date/time value, returning it as an integer between 0 and 23. This function is useful for time-based calculations, filtering, and reporting where you need to work with specific hours of the day.
HOUR(date)
HOUR() returns an integer between 0 and 23
HOUR(DATE(2025, 7, 4, 12, 30, 22)) = 12 (noon)
HOUR(DATE(2025, 12, 25, 8, 10, 20)) = 8 (morning)
HOUR(DATE(2025, 1, 1, 0, 0, 0)) = 0 (midnight)
HOUR(DATE(2025, 1, 1, 23, 59, 59)) = 23 (11 PM)
HOUR(DATE(2025, 1, 1, 15, 30, 0)) = 15 (3 PM)
HOUR(CURDATE()) = 14 (if run at 2 PM)
HOUR(NULL) = NULL