• PHP Video Tutorials

geoip_time_zone_by_country_and_region()



The geoip_time_zone_by_country_and_region() function can return the time zone for some country and region code combo.

Syntax

string geoip_time_zone_by_country_and_region( string $country_code [, string $region_code ] )

The geoip_time_zone_by_country_and_region() function can be available if GeoIP library version 1.4.1 or newer. The data can be taken directly from the GeoIP library and not from any database.

The geoip_time_zone_by_country_and_region() function can return the time-zone on success or false if country and region code combo can't be found.

Example 1

<?php
   $timezone = geoip_time_zone_by_country_and_region("CA", "QC");
   if($timezone) {
      echo "Time zone for CA/QC is: " . $timezone;
   }
?>

Example 2

<?php
   $timezone = geoip_time_zone_by_country_and_region("JP", "01");
   if ($timezone) {
      echo "Time zone for JP/01 is: " . $timezone;
   }
?>
php_function_reference.htm
Advertisements