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

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...