Year()

Syntax

Year(SerialNumber)

Remarks

Returns an integer between 1899 and 4095, inclusive, corresponding to the year component of SerialNumber, a decimal representation of the date, time, or both. For information about serial numbers, see DateSerial().

Example

This example returns the year component of the current date, converts it to a string, and then shortens the string to only the final two digits:


years = Year(Now())
years$ = Str$(years)
years$ = Right$(years$, 2)

See Also

DateSerial(), Day(), Hour(), Minute(), Month(), Now(), Second(), Today(), Weekday()