Year Function

Returns the year from a serial date number that is generated by the DateSerial or the DateValue function.

Sintaksis:

Year (Angka)

Nilai hasil:

Integer

Parameter:

Number: Integer expression that contains the serial date number that is used to calculate the year.

This function is the opposite of the DateSerial function, and returns the year of a serial date. For example, the expression:

Print Year(DateSerial(1994, 12, 20))

menghasilkan nilai 1994.

Kode kesalahan:

5 Tidak sah dalam pemanggilan prosedur

Contoh:

Sub ExampleYear

    MsgBox "" & Year(Now) ,64,"Tahun saat ini"

End Sub