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

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

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

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by trycia.jones , 4 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;
?>

Related Threads:

How will you calculate days between two dates in PHP?
How can you get web browser’s details using PHP?
What Are the Best Practices for Writing Secure Oracle Sql Queries?
What Are the Best Practices for Managing Oracle Sql Databases?
What Is the Best Beginner-friendly Sql Tutorial for Learning Database Management?
How to Use Php to Parse Json Data in 2025?