2010-09-01 96 views

回答

3

使用to_days

select to_days(concat(year(now()),'-12-31')) - to_days(now()) as days_left; 
+-----------+ 
| days_left | 
+-----------+ 
|  121 | 
+-----------+ 

或使用datediff這樣

select datediff(concat(year(now()),'-12-31'), now()) as days_left; 
+-----------+ 
| days_left | 
+-----------+ 
|  121 | 
+-----------+ 
0

的MySQL具有的一切功能。
一,你在這個特殊的情況下需要的是TO_DAYS()