2012-02-26 54 views

回答

1

的MySQL:

YEAR(CURDATE()) - YEAR(datecolumn) 

PHP:

$interval = date_diff($datetime1, $datetime2); 
echo $interval->y; 
+0

http://meta.stackexchange.com/questions/50358/what-is-with-people-who-answer-questions-that-are-known-to-be-dupes – 2012-02-26 19:26:04