Home > Backend Development > PHP Tutorial > PHP calculation difference function sharing between two dates, PHP calculation difference function_PHP tutorial

PHP calculation difference function sharing between two dates, PHP calculation difference function_PHP tutorial

WBOY
Release: 2016-07-13 10:08:28
Original
878 people have browsed it

PHP calculation difference function sharing between two dates, PHP calculation difference function

A very simple and practical function to share with everyone,

Provide the code:

Copy code The code is as follows:

/**
* * Date-calculate the difference between two dates
* * @return int
​​*/
Public function get_difference($date, $new_date) {
          $date = strtotime($date);
          $new_date = strtotime($new_date);
           return abs(ceil(($date - $new_date)/86400));
}

Super simple, no more nonsense here, I hope you guys like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/951637.htmlTechArticlePHP calculation difference function between two dates is shared. PHP calculation difference function is a very simple and practical function to share with everyone. , here is the code: Copy the code as follows: /** * Date-calculate 2 dates...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template