Home  >  Article  >  Backend Development  >  PHP get the number of days between 2 dates

PHP get the number of days between 2 dates

WBOY
WBOYOriginal
2016-07-25 08:43:25938browse
  1. function daysbetweendates($date1, $date2){
  2. $date1 = strtotime($date1);
  3. $date2 = strtotime($date2);
  4. $days = ceil(abs($date1 - $date2)/86400);
  5. return $days;
  6. }
复制代码

PHP


Statement:
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