MySQL YEAR() Function

MySQL | YEAR() Function: Learn about the YEAR() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 13, 2022

YEAR() Function

The YEAR() function is used to get the year part from the date which you will provide as a parameter.

YEAR() Syntax

SELECT YEAR(date);

YEAR() Parameter(s)

  • You only have to provide a valid date as a parameter.

YEAR() Return Value

As a result, it will return you the year part of from the date.

MySQL YEAR() Function Example 1

SELECT YEAR('2022-11-11');
Example 1: MySQL YEAR() Function

MySQL YEAR() Function Example 2

SELECT YEAR('1987-10-11');
Example 2: MySQL YEAR() Function


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.