bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL HOUR() Function

Concept visual

MySQL HOUR() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the hour part of a datetime: SELECT HOUR("2017-06-20 09:34:00");

Definition and Usage

The HOUR() function returns the hour part for a given date (from 0 to 838).

Syntax

Hour(

datetime )

Parameter Values

Parameter

Description datetime

Required. The datetime value to extract the hour from

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the hour part of a datetime: SELECT HOUR("838:59:59");

Previous

❮ MySQL Functions

Next

Previous

MySQL FROM_DAYS() Function

Next

MySQL LAST_DAY() Function