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