/**
* 获得当前格林威治时间的时间戳
*
* @return integer
*/
function gmtime()
{
return (time() - date('Z'));
}
/**
* 将GMT时间戳格式化为用户自定义时区日期
*
* @param string $format
* @param integer $time 该参数必须是一个GMT的时间戳
*
* @return string
*/
function local_date($format, $time = NULL)
{
$timezone = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : '+8';
if ($time === NULL)
{
$time = gmtime();
}
elseif ($time <= 0)
{
return '';
}
$time += ($timezone * 3600);
return date($format, $time);
}