<?php
$time 1 = "2008-6-15 11:49:59";//First time
$time 2 = "2007-5-5 12:53:28";//second time
$t 1 = strtotime ($time 1);
$t 2 = strtotime ($time 2);
$t = ABS ($t 1-$t 2);
$start = 0;
$string = "Two time difference:";
$y = Floor ($t 12/(3600*24*360));
if ($start | | $y)
{
$start = 1;
$t-= $y *3600*24*360;
$string. = $y. " Years ";
}
$m = Floor ($t 12/(3600*24*31));
if ($start | | $m)
{
$start = 1;
$t-= $m *3600*24*31;
$string. = $m. " Month ";
}
$d = Floor ($t 12/(3600*24));
if ($start | | $d)
{
$start = 1;
$t-= $d *3600*24;
$string. = $d. " Days ";
}
$h = Floor ($t 12/(3600));
if ($start | | $h)
{
$start = 1;
$t-= $h *3600;
$string. = $h. " Time ";
}
$s = floor ($t 12/(60));
if ($start | | $s)
{
$start = 1;
$t-= $s *60;
$string. = $s. " Points ";
}
$string. = "{$t 12} seconds";
Echo $string;
?>
PHP calculates the difference between the two dates, and concludes that the day of the month and the second