Siebel VB Language Reference > VB Language Reference >

Year Function


This standard VB function returns the year component of a date-time value.

Syntax

Year(date)

Argument
Description

date

An expression that can evaluate to a date/time value

Returns

An integer between 100 and 9999, inclusive.

Usage

Year accepts any type of date, including strings, and attempts to convert the input value to a date value.

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

Example

This example returns the year for today.

Sub Button_Click
   Dim nowyear
   nowyear = Year(Now)
End Sub

See Also

Date Function
Date Statement
Hour Function
Minute Function
Month Function
Now Function
Second Function
Time Function
WebApplet_InvokeMethod Event

Siebel VB Language Reference