weekofyear('20121231')
返回1,而weekofyear('20121230')
返回52
Mysql Ver 5,1,47 Cummunity Nt / Windows 7 32 Bit / ODBC 5.1.10 /
First day of Week : Sunday
它应该返回53但它返回1,
week('20121231',1)
,week('20121230')
在两个案例中都返回53
答案 0 :(得分:3)
答案 1 :(得分:0)
根据documentation,weekofyear('20121231')
不等同于week('20121231',1)
:
WEEKOFYEAR()
是兼容性函数,相当于WEEK(date,3)
。
测试它:
mysql> SELECT weekofyear('20121231'), week('20121231',1), week('20121231',3);
+------------------------+--------------------+--------------------+
| weekofyear('20121231') | week('20121231',1) | week('20121231',3) |
+------------------------+--------------------+--------------------+
| 1 | 53 | 1 |
+------------------------+--------------------+--------------------+