YEAR(date)

Returns the year from a date (Integer).


dateThe date you want the year from (Date).

REMARKS
* If "date" is Null, then Null is returned
* The "date" can actually be any date, string or numerical expression.
* You can use the DATE function to return the current system date.
* You can use the DAY function to return the day from a given date.
* You can use the MONTH function to return the month from a given date.
* The equivalent .NET function is Microsoft.VisualBasic.DateAndTime.Year
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print Now()                       '= 01/09/2021 23:56:17  
Debug.Print Year(Now()) '= 2021
Debug.Print Year("01/02/2020") '= 2020
Debug.Print Year("1 Feb 2020") '= 2020
Debug.Print Year("February 12, 2020") '= 2020
Debug.Print Year(256) '= 1900
Debug.Print Year(356) '= 1900
Debug.Print Year(2000) '= 1905

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top