如何使用PHP获取特定时区的当前时间


how to get current time of specific timezone using PHP

PHP中是否有任何方法或函数可以从互联网上获取特定时区的当前DateTime。不是本地系统的时间。请引导我。

$now = new DateTime();
$now->setTimezone(new DateTimezone('Europe/Paris'));
echo $now->format('Y-m-d H:i:s');

'Europe/Paris'替换为您想要的任何时区