YEAR

Retrieves the year component from a given date

Description

The YEAR() function extracts and returns the year component from a given date or datetime. This is useful for date-based analysis, organizing data by years, or generating annual reports.

Syntax

YEAR(date)

  1. date: The date or datetime from which you want to extract the year component.

Example

Table

Transaction
Sale Date

Transaction A

2023-09-10

Transaction B

2022-08-25

Transaction C

2021-09-01

Function

YEAR(`Sale Date`)

Results

YEAR (integer)

2023

2022

2021

Last updated