Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

HOUR

Example

Retrieve the hour component of a datetime.

SELECT HOUR(“2017-06-20 09:34:00”);

Definition and Usage

The HOUR() function retrieves the hour part from a given date, ranging from 0 to 838.

Syntax

HOUR(datetime)

Parameter Values

Parameter

Description

datetime

Required: The datetime value from which to extract the hour.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Retrieve the hour component from a datetime.

SELECT HOUR(“838:59:59”);