Getting Time Zone
Get the time zone information and country information of the requesting IP. If there is no value in the ip
field in Request Body, the time zone and the country information of the IP calling this API is returned.
- Request URL
Common URL | https://timezone.qpyou.cn/public/api/getTimezone |
---|---|
Distributed Environment URL | https://timezone.globalwithhive.com/public/api/getTimezone |
Sandbox URL | https://sandbox-timezone.qpyou.cn/public/api/getTimezone |
HTTP Method | POST |
Content-Type | text/html |
Data Format | JSON |
Note
The Time Zone API has a distributed processing environment in case of a failure or poor network. If the communication timeout set for your game server is exceeded due to a failure or network problem, call this API using the distributed environment URL.
- Request Body
Field Name | Description | Required |
---|---|---|
ip | If the requesting IP(IPv4 or IPv6) is null, it gets the time zone and the country data through the IP of API-implementing client. | N |
- Response
Field Name | Description | Required |
---|---|---|
result_code | Result code. 0=Success | Integer |
result_msg | Result message | String |
timezone | Object-type time zone Refer to the following Timezone object | Object |
country_diff |
| Boolean |
- Timezone object
Field Name | Description | Type |
---|---|---|
zone_id | Location identifiers provided by time zone database | String |
country_code | Country code based on the ISO 3166-1 alpha-2 | String |
zone_name | Local name | String |
country_name | Country name | String |
abbreviation | The abbreviation of standard time by country | String |
gmt_offset | Time difference (Unit: second) | String |
dst | The use of summer time | String |
- Request Sample
//IPv4
{
"ip" : "127.0.0.1"
}
//IPv6
{
"ip" : "::ffff:dc46:52e7" or "0:0:0:0:0:ffff:dc46:52e7" or "0000:0000:0000:0000:0000:ffff:dc46:52e7"
}
- Response Sample
//Example 1
{
"result_code": 0,
"result_message": "Success",
"timezone": {
"zone_id": "361",
"country_code": "VN", //location-based country code
"zone_name": "Asia/Bangkok", //name of timezone
"country_name": "Vietnam",
"abbreviation": "ICT",
"gmt_offset": "25200",
"dst": "0"
},
"country_diff": true //In the case of "Asia/Bangkok", the country code is TH, and the country code from IP geolocation is VN. Set to true because they are different to each other.
}
//Example 2
{
"result_code": 0,
"result_message": "Success",
"timezone": {
"zone_id": "212",
"country_code": "KR", //location-based country code
"zone_name": "Asia/Seoul", // Name of time zone
"country_name": "Korea, Republic of",
"abbreviation": "KST",
"gmt_offset": "32400",
"dst": "0"
},
"country_diff": false // In the case of "Asia/Seoul", the country code is KR and the country code from the IP geolocation is also KR, so set to false.
}
Note
When the time zone of requesting IP is not identified, success is returned as result value, and "UNKNOWN" is returned as country_code value.
- Response Sample in case IP unable to identify the time zone