Hi @bcworkz ,
Thank you for your reply. I contacted Siteground support (Our hosting server is Siteground) and they said there is nothing wrong at their end. It seems, since we are currently using PHP 7.4, the version of the timezone database is 2022.01.
This means that the list of countries which is available for us was last updated on this date, and that all countries should be available there.
Below is my PHP code:
//Using cookie
global $user_timezone_offset;
$userTimezone;
$offset_seconds = -$user_timezone_offset*60; // The timezone offset to search for in seconds
$timezone_identifiers = DateTimeZone::listIdentifiers(); // Get a list of timezone identifiers
foreach ($timezone_identifiers as $timezone_identifier) {
$timezone = new DateTimeZone($timezone_identifier);
$timezone_offset = $timezone->getOffset(new DateTime());
if ($timezone_offset == $offset_seconds) {
$userTimezone = new DateTimeZone($timezone_identifier);
break;
}
}
$originalTimezone = new DateTimeZone('America/Chicago');
$dateTime = new DateTime($input_arr['input_time'], $originalTimezone);
$dateTime->setTimezone(new DateTimeZone($userTimezone->getName()));
echo $dateTime->format('g:i A T');
And it is showing offset as shown in the screenshot.
https://www.awesomescreenshot.com/image/39326805?key=73f494d9ec20671e53134cfe4bdf35ec