Bug #47900 mysql's yearwek vs php's date
Submitted: 7 Oct 2009 17:19 Modified: 7 Oct 2009 17:49
Reporter: william lam Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:all OS:Any
Assigned to: CPU Architecture:Any

[7 Oct 2009 17:19] william lam
Description:
mysql's yearweek() function uses a different system than that of date() of php. for example, yearweek('2009-1-1') is 200852 but date("YW",mktime(0,0,0,mktime(0,0,0,1,1,2009)) is 20091. an option to align these two is needed.

How to repeat:
try above function calls
[7 Oct 2009 17:49] Todd Farmer
Not a bug, compatibility modes exist.  See http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_yearweek :

mysql> select yearweek('2009-1-1');
+----------------------+
| yearweek('2009-1-1') |
+----------------------+
|               200852 |
+----------------------+
1 row in set (0.00 sec)

mysql> select yearweek('2009-1-1', 1);
+-------------------------+
| yearweek('2009-1-1', 1) |
+-------------------------+
|                  200901 |
+-------------------------+
1 row in set (0.00 sec)