Converting timestamp (bigint) from mysql to date in php

hi guys
i’m having a bit of a problem displaying a timestamp (bigint) from mysql
as a date in php
i want to use gmt + 10 hours to get it to melbourne time


while($row = mysql_fetch_array($result)) {
	$ts = mktime(gmdate("H:i:s M-d-Y", $row['editDate']));
	$d = date("H:i:s d-M-Y", ($ts + 36000));
	echo($d);
}

say it loops through ten times or something
it will write out the same value (the newest date) for each row
even if they are all different
but if i write out the timestamp value
it will write out the different timestamp values

using unix_timestamp(now()) to update the database

so the problem is that it seems to only be executing
that function on the first value in the table
thanks for any help

The problem is that you’re converting your UNIX timestamp to GMT format, then trying to generate a UNIX timestamp from the GMT-formatted date. Well, mktime() takes about 20 arguments (not really ;)) and it’s probably only accepting the hour as its first parameter and forgetting about the rest.

But your logic is a bit circular, if I may say so. Why convert from a UNIX timestamp to something else, only to convert back to a UNIX timestamp? You’ve got the UNIX timestamp from the beginning, so you might as well make good use of it!

Try this instead:

while ($row = mysql_fetch_array($result))
{
    echo date('H:i:s d-M-Y', $row['editDate']+36000);
}

cool
i think that’s worked
thanks for the pointer