$date = new DateTime("now", new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone('America/Los_Angeles')); echo $date->format('Y-m-d H:i:s T');
$date = new DateTime("now", new DateTimeZone('UTC')); $date->setTimezone(new DateTimeZone('America/New_York')); echo $date->format('Y-m-d H:i:s T');This code will output the current date and time in the Eastern Standard Time (EST) timezone. Package library: No package library is needed as this is a built-in PHP function.