使用strtotime函数具体可以参考手册,再给一个简单的例子
$a='2004-5-8';
$b='204-6-8';$day=(strtotime($b)-strtotime($a))*60*60*24;
echo $day;