Hello in my database date / time are in this format
2010-06-01T18:20:25+0000
I\'d like to echo that out to time passed since that date / t
I changed one line of the above code for the case in which it was posted less than one minute ago.
function ax_getRoughTimeElapsedAsText($iTime0, $iTime1 = 0)
{
if ($iTime1 == 0) { $iTime1 = time(); }
$iTimeElapsed = $iTime1 - $iTime0;
if ($iTimeElapsed < (60)) {
return "Less than a minute ago";
} else if ($iTimeElapsed < (60*60)) {
$iNum = intval($iTimeElapsed / 60); $sUnit = "minute";
} else if ($iTimeElapsed < (24*60*60)) {
$iNum = intval($iTimeElapsed / (60*60)); $sUnit = "hour";
} else if ($iTimeElapsed < (30*24*60*60)) {
$iNum = intval($iTimeElapsed / (24*60*60)); $sUnit = "day";
} else if ($iTimeElapsed < (365*24*60*60)) {
$iNum = intval($iTimeElapsed / (30*24*60*60)); $sUnit = "month";
} else {
$iNum = intval($iTimeElapsed / (365*24*60*60)); $sUnit = "year";
}
return $iNum . " " . $sUnit . (($iNum != 1) ? "s" : "") . " ago";
}