php计算2个日期的差值函数分享


非常简单实用的函数分享给大家,

奉上代码:

复制代码 代码如下:

/**
     *    日期-计算2个日期的差值
     *  @return int
     */
    public function get_difference($date, $new_date) {
        $date = strtotime($date);
        $new_date = strtotime($new_date);
        return abs(ceil(($date - $new_date)/86400));
    }

超级简单,这里就不多废话了,希望小伙伴们能够喜欢。


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3