ali 2017-06-26 15:14:10 2927次浏览 0条评论 3 1 0
echo calculateDays('1997-06-09',date("Y-m-d"));
function calculateDays($datetime1,$datetime2){
    $old =strtotime($datetime1);
    $new =strtotime($datetime2);
    $age=round(($new-$old)/86400/12/30);
    if (date("m-d") > substr($datetime1,5)){
        $days=mktime(0,0,0,substr($datetime1,5,2),substr($datetime1,8),date("Y",strtotime("+1 year")))-$new;
        return  "还有".($days/86400)."天";
    }if (substr($datetime1,5) == date("m-d")){
        $days=mktime(0,0,0,substr($datetime1,5,2),substr($datetime1,8),date("Y"))-$new;
        if (($days/86400)===0){
            return "Happy birthday :)";
        }
    }
}
觉得很赞
    没有找到数据。
您需要登录后才可以评论。登录 | 立即注册