HOUR Function [Date and Time]

Returns a number from 0 to 23 corresponding to the hour component of the specified date/time.

Syntax

HOURdatetime-expression )
Parameters

Parameter

Definition

datetime-expression

The date/time.

Returns

SMALLINT

Example

The following statement returns the value 21:

SELECT HOUR( '1998-07-09 21:12:13' ) FROM iq_dummy

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.