HOUR Function (VisioShapeSheet)

Returns an integer, 0 to 23, representing the hour of the day of datetime or expression.

Syntax

HOUR(" datetime "| expression [, lcid ])

Parameters

Name Required/Optional Data Type Description
datetime
Required
String
A string commonly recognized as a date and time or a reference to a cell containing a date and time.
expression
Required
Varies
An expression that yields a date and time.
lcid
Optional
Number
A locale identifier to be used in evaluating a nonlocal datetime. The locale identifier is a number described in the system header files.

Remarks

The date component in datetime and expression is discarded.

No rounding is done. If the datetime is missing or cannot be converted to a valid result, the function returns an error.

The returned value is formatted according to the time style set by the system's current Regional Settings.

The HOUR function also accepts a single number value for expression where the decimal portion of the result represents the fraction of a day since midnight.

Example 1

HOUR("15:45")

Returns 15.

Example 2

HOUR("May 30, 1997 3:45:24 PM")

Returns 15.

Example 3

HOUR(0.5)

Returns 12.

Example 4

HOUR("5/30/1997")

Returns 0.