Php displays wrong time
<p>I have a php script that collects data with the current timestamp. </p>

<p>The timestamp in the mysql database is correct (giving the correct time and date), although on the front end it displays : <strong>in 5 hours</strong></p>

<p>The script that generates this output looks like this:</p>

<pre><code>function plural($num) {
    if ($num != 1)
    return "s";
}

function relative_date($date) {
    $diff = time() - strtotime($date);
    if ($diff&gt;0) {
        if ($diff&lt;60)
            return $diff . " second" . plural($diff) . " ago";
        $diff = round($diff/60);
        if ($diff&lt;60)
            return $diff . " minute" . plural($diff) . " ago";
        $diff = round($diff/60);
        if ($diff&lt;24)
            return $diff . " hour" . plural($diff) . " ago";
        $diff = round($diff/24);
        if ($diff&lt;7)
            return $diff . " day" . plural($diff) . " ago";
        $diff = round($diff/7);
        if ($diff&lt;4)
            return $diff . " week" . plural($diff) . " ago";
        return date("M j, Y", strtotime($date));
    } else {
        if ($diff&gt;-120)
            return "Right now";
        if ($diff&gt;-60)
            return "in " . -$diff . " second" . plural($diff);
        $diff = round($diff/60);
        if ($diff&gt;-60)
            return "in " . -$diff . " minute" . plural($diff);
        $diff = round($diff/60);
        if ($diff&gt;-24)
            return "in " . -$diff . " hour" . plural($diff);
        $diff = round($diff/24);
        if ($diff&gt;-7)
            return "in " . -$diff . " day" . plural($diff);
        $diff = round($diff/7);
        if ($diff&gt;-4)
            return "in " . -$diff . " week" . plural($diff);
        return date("M j, Y", strtotime($date));
    }
}
</code></pre>

<p>How can I get that to show me the correct time?</p>
