I have dates stored in a MySQL database. They originally come from the PHP "time()" stamp and are stored like this,
$curtime = time();
UPDATE chatrecords SET liveadmin = FROM_UNIXTIME($curtime) WHERE chatid = '$v_chatid'";
they are then retrieved later like this,
"SELECT UNIX_TIMESTAMP(liveadmin) AS liveadmin FROM chatrecords WHERE closed = '0000-00-00 00:00:00' ORDER BY opened DESC"
I then want to display the times to the user using the PHP date function and do that like this,
while ($var = mysql_fetch_assoc($result)) {
$tmp = $var['liveadmin'];
$o_openchats .= date("d/m/y H:i:s",$tmp);
}
This displays the minutes and seconds without a problem, but for some reason I can't work out always adds 1 to the hour. So when it should be 7 minutes it will show 1 hour and 7 minutes. And when it's 1 hour and 7 minutes it would show 2 hours and 7 minutes.
Anyone have any ideas what I'm doing wrong?
Thanks,
Matt