Rechercher une fonction PHP

geoip _time _zone _by _country _and _region

(PECL geoip >= 1.0.4)

geoip_time_zone_by_country_and_regionReturns the time zone for some country and region code combo

Description

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

The geoip_time_zone_by_country_and_region() function will return the time zone corresponding to a country and region code combo.

In the United States, the region code corresponds to the two-letter abbreviation of each state. In Canada, the region code corresponds to the two-letter province or territory code as attributed by Canada Post.

For the rest of the world, GeoIP uses FIPS 10-4 codes to represent regions. You can check » http://www.maxmind.com/app/fips10_4 for a detailed list of FIPS 10-4 codes.

This function is always available if using GeoIP Library version 1.4.1 or newer. The data is taken directly from the GeoIP Library and not from any database.

PHP: geoip_time_zone_by_country_and_region - Manual Home of Manuel PHP  Contents Haut

Parameters

country_code

The two-letter country code (see geoip_country_code_by_name())

region_code

The two-letter (or digit) region code (see geoip_region_by_name())

PHP: geoip_time_zone_by_country_and_region - Manual Home of Manuel PHP  Contents Haut

Return Values

Returns the time zone on success, or FALSE if the country and region code combo cannot be found.

PHP: geoip_time_zone_by_country_and_region - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 A geoip_time_zone_by_country_and_region() example using region code for US/Canada

This will print the time zone for country CA (Canada), region QC (Quebec).

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

The above example will output:

Time zone for CA/QC is: America/Montreal

Example #2 A geoip_time_zone_by_country_and_region() example using FIPS codes

This will print the time zone for country JP (Japan), region 01 (Aichi).

<?php
$timezone 
geoip_time_zone_by_country_and_region('JP''01');
if (
$timezone) {
    echo 
'Time zone for JP/01 is: ' $timezone;
}
?>

The above example will output:

Time zone for JP/01 is: Asia/Tokyo

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-geoip-time-zone-by-country-and-region.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut