You are here: Function Reference > Alphabetical Listing > H > Hour

Hour

Use this function to extract the number of hours from a time.

Syntax

Hour (Time1, Format1)

Parameter

Description

Time1

Enter a valid time string. Assumed to be in the format specified by the next parameter. The default is the current time.

Format1

Enter a valid time format string. Describes the first parameter (time1). The default is time format 1 (HH:MM:SS).

Example

Here are some examples:

(Assume the current time is 03:05:09 pm.)

Function

Result

Explanation

Return(Hour( ))

3

Defaults to the current time and extracts 3.

Return(Hour ("9:50:20AM", 2))

9

Reads the given time which is in format 2 and extracts 9.

See also