note 39352 added to ref.datetime
| From: | wwb_99 at yahoo dot com | Date: | Sun, 25 Jan 2004 18:12:02 +0000 |
| Subject: | note 39352 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64169@lists.php.net to get a copy of this message | ||
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;
}
----
Manual Page -- http://www.php.net/manual/en/ref.datetime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39352
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39352&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39352&report=yes
Search -- http://master.php.net/manage/user-notes.php