weekofyear('20121231')
返回1,而weekofyear('20121230')
收益52我如何解決weekofyear('20121231')返回1?
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我如何解決weekofyear('20121231')返回1?
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在這兩種情況下
按照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 |
+------------------------+--------------------+--------------------+
WEEKOFYEAR()是一個函數的相容性,它等效於 WEEK(日期,3) –