YEARWEEK(date[,first])

Description: Returns the year and week of date (a date, or date and time). The optional argument first can be used to specify the first day of the week, working in the same way as the argument in WEEK().

Examples:

  • YEARWEEK('2001-02-01') returns 200104.

  • YEARWEEK('2002-01-01',1) returns 200201.

See also: YEAR(), WEEK()

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.