Year (function)

Syntax

Year(date)

Description

Returns the year of the date encoded in the specified date parameter. The value returned is between 100 and 9999 inclusive.

The date parameter is any expression representing a valid date.

Example

This example returns the current year in a dialog box.

Sub Main()

  tdate$ = Date$
  tyear! = Year(DateValue(tdate$))
  MsgBox "The current year is " & tyear!
End Sub

See Also

Day (function) Minute (function); Second (function); Month (function); Hour (function); Weekday (function); DatePart (function).

More information

Basic Control Engine Language Reference