I want to get the time zone abbreviation of visitor and for this purpose i am using the below code:
$ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
$visitor_country_code = $details->country . 'T';
From this i got the first two letters of country name and concatenated 'T'.But this is working only for few countries.I tested it by changing proxy and it worked for Pakistan and then i tried for USA and it gave me error
DateTimeZone::__construct(): Unknown or bad timezone (AEDT)
Can someone help me to get the country code of all countries?