Year (function)

<< Click to Display Table of Contents >>

Year (function)

Year(Expression)

Returns the year of the given date.

Expression is a numeric or string expression which represents a date.

The result is an integer value between 100 and 9999.

See also: Date, Day, Hour, Minute, Month, Now, Second, Time, Weekday

Example:

Sub Main

 T1 = Now     ' Now = current date + time

 MsgBox T1

 MsgBox "Day: " & Day(T1)

 MsgBox "Month: " & Month(T1)

 MsgBox "Year: " & Year(T1)

 MsgBox "Hours: " & Hour(T1)

 MsgBox "Minutes: " & Minute(T1)

 MsgBox "Seconds: " & Second(T1)

End Sub