Heres the deal I have a timestamp in my mysql database, however when I put the timestamp in it comes from the server which is located on the west coast 3 hours behind the east coast time that I would like. Is there any functions in php that I can use to adjust this. Heres is my code
$timenow = date( "Y-m-d h:i:s a" );
$sql2= "INSERT INTO comments ( ID , NAME ,
MESSAGE,DATE` )
VALUES ('', '$name', '$message', '$timenow')";
.....
function formatDate($val){
if ($val==""){return "unknown";}
$month, $day, $year));
// split up the timestamp
$year=substr($val,0,4);
$month=substr($val,4,2);
$day=substr($val,6,2);
$hh=substr($val,8,2);
$mm=substr($val,10,2);
// convert it into a standard timestamp and format it
$date = date("M d, Y @ g:i a",mktime($hh, $mm, 0,
return $date;
}
I tried adding 3 hours to the $hh variable and that worked but the am and pm is still screwed up on certain cases like if the west coas time is 10pm the east coast time would be 1am so i would still have pm and the day of the month is off too!
Any solutions without parsing the string and fixing every field???
Perhaps I should put it into the db as the correct east coast time? but how?
Thanks?