Source Code:
(back to article)
<?php // Create a new DateTime object for March 1st, 2023 at 12:00 PM $date = new DateTime('2023-03-01 12:00:00'); // Set the timezone to America/New_York $date->setTimezone(new DateTimeZone('America/New_York')); // Get the timezone of the DateTime object $timezone = date_timezone_get($date); // Display the timezone name echo $timezone->getName();
Result:
Report an issue