SpreadJS Documentation
HOUR
SpreadJS Documentation > Formula Reference > Formula Functions > HOUR

This function returns the hour that corresponds to a specified time.

Syntax

HOUR(time)

Arguments

Specify the time argument as a number (as in 37806.5) a string (as in "7/4/2003 12:00"), a DateTime object, as in DATE(2003,7,4), or a TimeSpan object, as in TIME(12,0,0).

Dates as numeric values are in the form x.y, where x is the "number of days since December 30, 1899" and y is the fraction of day. Numbers to the left represent the date. Times as numeric values are decimal fractions ranging from 0 to 0.99999999, representing the times from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.).

Remarks

The hour is returned as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).

Data Types

Accepts numeric, string, DateTime object, or TimeSpan object data. Returns numeric data.

Examples

HOUR(A2)

HOUR(R2C1)

HOUR(0.25) gives the result 6

HOUR(347.25) gives the result 6

HOUR("2:22 PM") gives the result 14

HOUR("2:22 AM") gives the result 2

HOUR(TIME(12,0,0))

See Also