HOUR( ) Function

Returns the hour portion from a DateTime expression.

HOUR(tExpression)

Parameters

  • tExpression
    Specifies a DateTime expression from which HOUR( ) returns the hour.

Return Value

Numeric

Remarks

HOUR( ) returns a numeric value based on a 24 hour format, and is not affected by the current setting of SET HOURS. For example, if SET HOURS is 12 or 24, the following command returns 13:

? HOUR({^1998-02-16 1:00p})

Example

The following example displays the hour portion of the current time and the hour portion of a specific time.

CLEAR
? HOUR(DATETIME( ))
? HOUR({^1998-02-16 10:42a})  && Displays 10

See Also

Reference

CTOT( ) Function
DATE( ) Function
DATETIME( ) Function
DTOT( ) Function
MINUTE( ) Function
SEC( ) Function
SECONDS( ) Function
SET SECONDS Command
TIME( ) Function

Other Resources

Functions
Language Reference (Visual FoxPro)