YEARWEEK
Return the year and week. This function returns the year and week number for a date, useful for grouping results by week.
Syntax
YEARWEEK(date), YEARWEEK(date,mode)Description
Examples
SELECT YEARWEEK('1987-01-01');
+------------------------+
| YEARWEEK('1987-01-01') |
+------------------------+
| 198652 |
+------------------------+CREATE TABLE t1 (d DATETIME);
INSERT INTO t1 VALUES
("2007-01-30 21:31:07"),
("1983-10-15 06:42:51"),
("2011-04-21 12:34:56"),
("2011-10-30 06:31:41"),
("2011-01-30 14:03:25"),
("2004-10-07 11:19:34");Last updated
Was this helpful?

