Returns an Integer value from 1 through 9999 representing the year.
Public Function Year(ByVal DateValue As DateTime) As Integer
You can also obtain the year by calling DatePart and specifying DateInterval.Year for the Interval argument.
This 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 MyDate As Date Dim MyYear As Integer MyDate = #2/12/1969# ' Assign a date. MyYear =Year(
MyDate)
' MyYear contains 1969.
Day Function | Month Function | Now Property | Weekday Function | DatePart Function |