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
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
根据文档,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 |
+------------------------+--------------------+--------------------+