June 4, 2015

PHP how to get total days between two date?



Following calculation for get total days between two difference date:

<?php
$dt1=date_create("2015-06-01");
$dt2=date_create("2015-06-04");
$diff=date_diff($dt1,$dt2);

echo $diff;

//Output
+3 days
?>


Enjoy!


No comments:

Post a Comment

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...