时区代码不适用于sentos vps,而在mamp上工作正常

时间:2014-09-24 11:50:58

标签: php centos

我有一个奇怪的问题。自从一个星期以来一直在努力但我认为我需要你的帮助。我的网站在mamp本地服务器和共享主机上工作正常但是当我把它放到我的centos vps时出现问题。我有一个时区转换代码,不能在vps上运行。它可能是vps设置的东西吗?任何帮助将不胜感激 。提前谢谢

 // time zone is saved in the session varial
<?php  $dateLocal=getLocalDate($timezone,$memberSince); $dateToPrint=printDate($dateLocal)
echo $dateToPrint;
?>;
// printing the date 
function printDate($date)
{
 $convertedDate=date("F j,Y g:i a",strtotime($date));
 return $convertedDate; 
}

 // convert one time zone to another 
 function getLocalDate($timezoneFromSession,$dateFromTheDatabase)
{
 $usersTimezone = new DateTimeZone($timezoneFromSession);// users time zone from the session           variable
 $l10nDate = new DateTime($dateFromTheDatabase);// date from the database
 $l10nDate->setTimeZone($usersTimezone); 
 return $l10nDate->format('Y-m-d H:i:s');
 }

0 个答案:

没有答案