YEAR

The YEAR function returns the year of a date as an integer in the range 100-9999.

Syntax

YEAR(
    date
)

Parameters
  • date: Value corresponding to a date in datetime format, or text representing a date.
Returned value

The YEAR function returns an integer in the range 100-9999.

Additional Information

Even though the YEAR function requires a datetime type argument, it can also receive a real number (in which the integer part is considered as a reference to the date and the decimal part as a reference to the time), with general or any other format. format (date and time or other). For this reason, the YEAR function takes both a time and a date as an argument. In the case of receiving an hour as an argument (without reference to a specific date), December 30, 1899 is assumed. Thus, the function

YEAR("15:13:43")

...will return 1899.

The date argument can be provided by a date/time creation function, by a function that returns a date/time value, by a reference to a column containing date/time values, or as a text string containing the value of date/time from which to extract the data sought. In the latter case, the YEAR function will use the regional configuration and the date and time settings of the client computer in order to interpret the text from which to extract the correct value. In this way, the following functions (which receive the same real number as an argument with a different format), will return the same value: 2016.

YEAR("15/10/2016 11:9:14")

YEAR (42658.4230787037)

However, the interpretation of a date such as "10/8/2016" will depend on the locale of the local computer. If it represents dates in "day/month/year" format, it will be interpreted as August 10, 2016. On the contrary, if it represents dates in "month/day/year" format, it will be interpreted as October 8 2016.

The value returned by this function will always be the one corresponding to the Gregorian calendar.

Unlike in Excel, the YEAR function allows you to work with years in the range 100-9999. Thus, the function

YEAR("1/1/100")

...returns 100. And:

YEAR("1/1/2000") - YEAR("1/1/100")

...returns 1900, just as you might expect.

Examples

The following example extracts the year from the field that contains the date and time of the sales:

YEAR function: Example of use

Related functions
Category
Date and time
Submitted by admin on Tue, 12/04/2018 - 00:10