dateDifference() public method

public dateDifference ( $past, $now = "now" )
Exemplo n.º 1
0
echo "<br/><strong>rule 11</strong> (2 yrs <-> max time or date # => over [2..X] years)<br/>";
$timeAgo = new TimeAgo();
echo $timeAgo->inWords("2009/4/26 00:00:00", "2011/4/26 00:00:00");
echo "<br/>";
$timeAgo = new TimeAgo();
echo $timeAgo->inWords("2005/4/26 00:00:00", "2011/4/26 00:00:00");
echo "<br/>";
$timeAgo = new TimeAgo();
echo $timeAgo->inWords("1999/4/26 00:00:00", "2011/4/26 00:00:00");
echo "<br/>";
echo "</p>";
echo "<h2>TimeAgo class tests (dateDifference)</h2>";
echo "<p>";
$timeAgo = new TimeAgo();
echo "<pre>";
print_r($timeAgo->dateDifference("2010/4/01 00:00:00", "2010/5/12 03:05:30"));
echo "</pre>";
echo "</p>";
echo "<h1>WWDateTime class tests!</h1>";
function test_time($timeAgo, $timeAsItShouldBe)
{
    echo "<p>";
    $datetime = new WWDateTime($timeAgo);
    echo $datetime->format(DATE_RFC3339);
    echo " = ";
    echo $datetime->timeAgoInWords();
    echo " === ";
    echo $timeAsItShouldBe;
    echo "</p>";
}
test_time("-2 year", "over 2 years");