If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
<?php
/*define a function.
* @param1 $date2
* @param2 $date2
* return boolean (true/false)
*/
function get_days($date1, $date2)
{
$diff = strtotime($date2) - strtotime($date1);
/*we knew that one day have 86400 seconds*/
return abs(round($diff / 86400));
}
$date1 = "25-09-2021";
$date2 = "31-01-2021";
$days = get_days($date1, $date2);
printf("Difference between two dates: ". $days . " Days ");
?>
Difference between two dates: 237 Days
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook