📌  相关文章
📜  在 PHP 代码示例中获取当前日期和时间

📅  最后修改于: 2022-03-11 14:53:38.975000             🧑  作者: Mango

代码示例6
phpCopysetTimezone(new DateTimeZone('Europe/Amsterdam'));
$DateAndTime = $Object->format("d-m-Y h:i:s a");  
echo "The current date and time in Amsterdam are $DateAndTime.\n";
$Object->setTimezone(new DateTimeZone('America/Toronto'));
$DateAndTime = $Object->format("d-m-Y h:i:s a");  
echo "The current date and time in Toronto are $DateAndTime.";
?>