Page 1 of 1

Is there a function that will ...?

Posted: Mon Jul 15, 2002 10:28 pm
by virgil
Hey PhP's :D

Is there a function that will return the difference between two dates?

i.e. Jul 15, 2002 - Aug 15, 2002 = 31 Days

Thanks..... Virgil

Posted: Mon Jul 15, 2002 10:36 pm
by hob_goblin

Code: Select all

<?
$_14 = mktime(0,0,0,7,14,2002);
$_to = time();
$_re = $_14 - $_to;
$_rem = $_re / 60;
$_reh = $_rem / 60;
$_red = $_reh / 24;

echo "<table cellpadding=3>";
echo "<tr><td>Seconds: </td><td>$_re</td></tr>";
echo "<tr><td>Minutes: </td><td>$_rem</td></tr>";
echo "<tr><td>Hours: </td><td>$_reh</td></tr>";
echo "<tr><td>Days: </td><td>$_red</td></tr>";
echo "</table>";

?>

Posted: Tue Jul 16, 2002 7:27 am
by virgil
Thanks Hob. That works, but is there a simple way to convert
"Aug 15, 2002" to "0,0,0,8,15,2002"?