bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL YEAR() Function

Concept visual

MySQL YEAR() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the year part of a date:

SELECT YEAR("2017-06-15");

Definition and Usage

The YEAR() function returns the year part for a given date (a number from 1000 to 9999).

Syntax

Year(

date )

Parameter Values

Parameter

Description date

Formula

Required. The date/datetime to extract the year from

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the year part of a date: SELECT YEAR("2017-06-15 09:34:21");

Example

Return the year part of the current system date:

SELECT YEAR(CURDATE());

Previous

❮ MySQL Functions

Next

Previous

MySQL WEEKOFYEAR() Function

Next

MySQL YEARWEEK() Function