Get Current Date and Time for Given Time Zone using PHP

DateTimeZone class

<?php

$dateTimeFormat = 'Y-m-d H:i:s';

$tz = new DateTimeZone('America/New_York');
$dt = new DateTime('now', $tz);

$dateTime = $dt->format($dateTimeFormat);

echo $dateTime;

Leave a Comment

Cancel reply

Your email address will not be published.