2010-04-09 74 views

回答

40

要麼

date('Y-m-d', strtotime('+11 hours')); 

添加11小時或創建一個DateTime對象,並改變它的時區在需要的地方

$datetime = new DateTime; // current time = server time 
$otherTZ = new DateTimeZone('America/Los_Angeles'); 
$datetime->setTimezone($otherTZ); // calculates with new TZ now 

或簡單的設置適當的時區與

+0

@Gordon是date_default_timezone_set還改變的值NOW()函數? – Simon 2010-04-09 13:05:46

+0

@Syom'php --rf now' =>'異常:函數now()不存在 - 您是否在SQL查詢中引用NOW()?您也必須在Sql服務器上更改它,例如http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html – Gordon 2010-04-09 13:10:17

+0

你的意思是Now()在dev.mysql.com/doc/mysql/en/date-and-time -functions.html? – VolkerK 2010-04-09 13:10:54

相關問題