How to get number of days between two given dates using PHP ?

by dion.waelchi , in category: Technology , 3 years ago

How to get number of days between two given dates using PHP ?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by trycia.jones , 3 years ago

@dion.waelchi You can use this simple script

1
2
3
4
5
<?php
  $tomorrow = mktime(0, 0, 0, date(“m”) , date(“d”)+1, date(“Y”));
  $lastmonth = mktime(0, 0, 0, date(“m”)-1, date(“d”), date(“Y”));
  echo ($tomorrow-$lastmonth)/86400;
?>