phpcrazy 2019-04-16
如下所示:
function gettime($worktime){ $time=time(); $amount=date("Y",$time)-date("Y",strtotime($worktime)); if (date("m",$time)<date("m",strtotime($worktime))) { $amount--; } elseif (date("m",$time)==date("m",strtotime($worktime))) { if (date("d",$time)<date("d",strtotime($worktime))) { $amount--; } } return $amount; }