Date and Time Functions 2170 -> 53 If a date falls in the last week of the previous year, MySQL returns  0  if you do not use  2 ,  3 ,  6 , or  7  as the optional  mode  argument: One might argue that  WEEK()  should return  52  because the given date actually occurs in the 52nd week of 1999.  WEEK()  returns  0  instead so that the return value is “the week number in the given year.”  This makes use of the  WEEK()  function reliable when combined with other functions that extract a date part from a date. If you prefer a result evaluated with respect to the year that contains the first day of the week for the given date, use  0 ,  2 ,  5 , or  7  as the optional  mode  argument. Returns the weekday index for  date  ( 0  = Monday,  1  = Tuesday, …  6  = Sunday). Returns the calendar week of the date as a number in the range from  1  to  53 .  WEEKOFYEAR()  is a compatibility function that is equivalent to  WEEK( date ,3) . Returns the year for  date , in the range  1000  to  9999 , or  0  for the “zero”  date. Returns year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year. The  mode  argument works exactly like the  mode  argument to  WEEK() . For the single-argument syntax, a  mode  value of 0 is used. Unlike  WEEK() , the value of  default_week_format  does not influence YEARWEEK() . mysql>  SELECT YEARWEEK(’1987-01-01’); mysql>  SELECT YEAR(’1987-01-01’); -> 1987 mysql>  SELECT WEEKOFYEAR(’2008-02-20’); -> 8 mysql>  SELECT WEEKDAY(’2008-02-03 22:23:00’); -> 6 mysql>  SELECT WEEKDAY(’2007-11-06’); -> 1 mysql>  SELECT YEARWEEK(’2000-01-01’); -> 199952 mysql>  SELECT MID(YEARWEEK(’2000-01-01’),5,2); -> ’52’ Alternatively, use the  YEARWEEK()  function: mysql>  SELECT WEEK(’2000-01-01’,2); -> 52 mysql>  SELECT YEAR(’2000-01-01’), WEEK(’2000-01-01’,0); -> 2000, 0 • WEEKDAY( date ) • YEAR( date ) • WEEKOFYEAR( date ) • YEARWEEK( date ) ,  YEARWEEK( date , mode )