public static function correctTime($time = 0, $tz_offset = null) { if (!is_numeric($time)) { $time = strtotime($time); } if (!$time) { $time = time(); } return is_null($tz_offset) ? $time : $time - date('Z') + $tz_offset * 3600; }