PHP: An hour ago, x hours ago
<p>So i have this function to show the time generated from the inserted unix format timestamp(time()):</p>

<pre><code>function get_time($timestamp) {
    $time = date('G:i', $timestamp);
    echo " at: ".$time;
    return $time;
}
</code></pre>

<p>I would like to expand this function and would like to do so if it has been under 24 hours, it should calculate and echo "x hours ago", if its yesterday or later, it should just echo like it does now ( echo " at: ".$time; ) ..</p>

<p>How can this be done?</p>
