2016-12-17 62 views

回答

1

試試這個:

$date = new DateTime(date('Y-m-d H:i:s'), new DateTimeZone('Europe/London')); 
echo $date->date; // It will return current date time at your specified timezone 
0

你應該傳遞PARAM /格式內date()這樣的:

$currentDateTime = new DateTime(date('Y-m-d H:i:s'), 'Europe/London'); 

希望這有助於!

1

需要提供格式向date()作爲參數。你可以使用如下。

$currentDateTime = new DateTime(date("Y-m-d"),new DateTimeZone('Europe/London'));