And Time. Year(DateTime) Method
Returns an integer value from 1 through 9999 representing the year.
public: static int Year(DateTime DateValue);
public static int Year (DateTime DateValue);
static member Year : DateTime -> int
Public Function Year (DateValue As DateTime) As Integer
Date value from which you want to extract the year.
An integer value from 1 through 9999 representing the year.
The following example uses the
Year function to obtain the year from a specified date. In the development environment, the date literal is displayed in short date format using the locale settings of your code.
Dim thisDate As Date Dim thisYear As Integer thisDate = #2/12/1969# thisYear = Year(thisDate) ' thisYear now contains 1969.
You can also obtain the year by calling
DatePart and specifying
DateInterval.Year for the