note 82079 deleted from function.idate by derick
| From: | derick@php.net | Date: | Sun, 11 May 2008 15:24:25 +0000 |
| Subject: | note 82079 deleted from function.idate by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139279@lists.php.net to get a copy of this message | ||
Note Submitter: tinelbarb at yahoo dot com(TG-JIU,ROMANIA) dot net
----
A very simple way to get the difference in days between two dates:
<?php
// Return the number of days between two dates
function daysBetween($date1, $date2)
{
/* SECOND VERSION (by Tinel Barb, Romania) */
$deadline1 = idate('U',strtotime($date1));
$deadline2 = idate('U',strtotime($date2));
$res = round( ($deadline2 - $deadline1) / 86400 );
return $res;
}
?>