PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I live in the central time zone in the United States. I think it is +6 difference relative to GMT. How would I convert the current GMT to my time zone?
function toGMT($time){
//set to local time zone relative to GMT (+6 for US CST)
$step = 6;
$mytime = substr($time,11);
$time_array = explode(":",$mytime);
$mydate = substr($time,0,10);
$date_array = explode("-",$mydate);
$newtime = date("Y-m-d H:i:s",mktime($time_array[0]-$step,$time_array[1],$time_array[2],$date_array[1],$date_array[2],$date_array[0]));
return $newtime;
}