Basic usage: Getting a human readable time difference

Just include the Date/HumanDiff.php file, instantiate a Date_HumanDiff object and run get() on it.

<?php
require_once 'Date/HumanDiff.php';
$dh = new Date_HumanDiff();
echo 
$dh->get(time() - 60) . "\n";
//prints out "5 minutes ago"
?>

get() accepts two parameters: The timestamp and the reference time. If the reference time is not provided, the current time is used. Both parameters may be unix timestamps, DateTime objects as well as strings that can be converted to a unix timestamp with strtotime.

The difference between timestamp and reference time is then converted into a human readable string.