Returns the year from the DateTime value passed to the function. If the date is in wrong format then the function returns the year extracted from system time.
= YEAR(value)
value |
A date time value from which the year has to be extracted. The value can contain DateTime as a string (e.g. “02/19/2009 14:30:30.3”, "2009-02-19 14:30:30.3", "19 Feb 2009 2:30:30.3 PM ", "Thu, 19 Feb 2009”) or as a DateTime object. |
Integer
In the case of an error, the function displays an error message: “YEAR(value): Error message”
Example |
Returns |
= YEAR(“02/19/2009 14:30:30.3”) |
2009 |
= YEAR("2009-02-19 14:30:30.3") |
2009 |
= YEAR(“abcd”) |
The year extracted from system date |
= YEAR(ShippedDate) |
The year extracted from the value of ShippedDate. If any entries are NULL then returns the year extracted from the system time. |