Difference between two dates in php

Here is an example on how to check to difference bewteen two dates in using PHP.

<?
$now = time();
$week = time()+60*60*24*7;
$diff = $week-$now;
echo $diff/(60*60*24)." days
"; // 7 Days
echo $diff/(60*60)." hours
"; // 168 hours
echo $diff/(60)." minutes
"; // 10080 minutes
?>
This entry was posted in Code Examples, PHP. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


4 + = 10

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>