2012-12-31 64 views
1

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在這兩種情況下

+0

WEEKOFYEAR()是一個函數的相容性,它等效於 WEEK(日期,3) –

回答

0

按照documentationweekofyear('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 | 
+------------------------+--------------------+--------------------+ 
相關問題