note 39352 deleted from ref.datetime by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 17:42:29 +0000 |
| Subject: | note 39352 deleted from ref.datetime by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133189@lists.php.net to get a copy of this message | ||
Note Submitter: wwb_99 at yahoo dot com
----
Handy little function getting the total difference in dates.
function DateDiff($tfirst, $tsecond)
{
//returns an array with numeric values for in an array measuring days, hours, minutes &
seconds
$ret=array();
$totalsec=$tsecond-$tfirst;
$ret['days']=round(($totalsec/86400));
$totalsec=$totalsec % 86400;
$ret['hours']=round(($totalsec/3600));
$totalsec=$totalsec % 3600;
$ret['minutes']=round(($totalsec/60));
$ret['seconds']=$totalsec % 60;
return $ret;
}