MySQL YEARWEEK Function

Example

Return the year and week number for a date:

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

Definition and Usage

The YEARWEEK() function returns the year and week number (a number from 0 to 53) for a given date.

Syntax

YEARWEEK(date, firstdayofweek)

Continue reading MySQL YEARWEEK Function

MySQL YEAR Function

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)

Continue reading MySQL YEAR Function