Siebel VB Language Reference > VB Language Reference >

Hour Function


This standard VB function returns the hour-of-day component (0-23) of a date-time value.

Syntax

Hour(time)

Argument
Description

time

Any numeric or string expression that can evaluate to a date-time or time value

Returns

If the expression evaluates to a date-time or time value, the hour component of that value; otherwise 0.

Usage

Time can be any type, including string, and the Hour function attempts to convert time to a date value.

The return value is a variant of vartype 2 (integer). If the value of time is Null, a variant of vartype 1 (null) is returned.

For Hour to function without an error, the values passed to it must be in some form that can be interpreted as a time or date-time value. Thus, 13:26, or 1:45:12 PM returns valid results, but 1326 returns a 0.

Time is a double-precision value. The numbers to the left of the decimal point denote the date and the decimal value denotes the time (from 0 to 0.99999). Use the TimeValue function to obtain the correct value for a specific time.

Related Topics

Date Statement
DateSerial Function
DateValue Function
Day Function
Minute Function
Month Function
Now Function
Second Function
Time Statement
TimeSerial Function
TimeValue Function
WebApplet_InvokeMethod Event
Year Function

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.