请求标头
| Name | Required | Description |
|---|---|---|
X-RapidAPI-Key | required | Your RapidAPI key. Get one free. |
X-RapidAPI-Host | required | timezone-by-city.p.rapidapi.com |
端点
GET
/v1/time/zone Look up the IANA time zone and current local time of a city
参数
| Name | Type | Required | Default | Constraints |
|---|---|---|---|---|
city | string | required | — | matches \S |
country | string | optional | — | — |
代码示例
curl --request GET \
--url 'https://timezone-by-city.p.rapidapi.com/v1/time/zone?city=example' \
--header 'x-rapidapi-key: YOUR_API_KEY' \
--header 'x-rapidapi-host: timezone-by-city.p.rapidapi.com' const url = "https://timezone-by-city.p.rapidapi.com/v1/time/zone?city=example";
const options = {
method: "GET",
headers: {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "timezone-by-city.p.rapidapi.com"
}
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data); import requests
url = "https://timezone-by-city.p.rapidapi.com/v1/time/zone"
querystring = {"city": "example"}
headers = {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "timezone-by-city.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
print(response.json()) GET
/v1/time/zone/countries List all countries with timezone data in the dataset, sorted alphabetically by ISO code.
代码示例
curl --request GET \
--url 'https://timezone-by-city.p.rapidapi.com/v1/time/zone/countries' \
--header 'x-rapidapi-key: YOUR_API_KEY' \
--header 'x-rapidapi-host: timezone-by-city.p.rapidapi.com' const url = "https://timezone-by-city.p.rapidapi.com/v1/time/zone/countries";
const options = {
method: "GET",
headers: {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "timezone-by-city.p.rapidapi.com"
}
};
const response = await fetch(url, options);
const data = await response.json();
console.log(data); import requests
url = "https://timezone-by-city.p.rapidapi.com/v1/time/zone/countries"
headers = {
"x-rapidapi-key": "YOUR_API_KEY",
"x-rapidapi-host": "timezone-by-city.p.rapidapi.com"
}
response = requests.get(url, headers=headers)
print(response.json()) 交互示例
$ GET /v1/time/zone?city=London
{"city":"London","country":"GB","timezone":"Europe/London","current_time":"2026-07-02T13:00:00+01:00","utc_offset":"+01:00"} 订阅和许可
通过 RapidAPI 上的商业就绪层访问此 API。专为副项目、初创公司和大批量生产架构设计的灵活计划。
开发者支持
需要集成帮助或有自定义端点请求?我们的工程团队随时为身份验证、有效负载模式和高频速率限制增加提供协助。
系统性能
全天候 24/7 监控,正常运行时间 SLA 达 99.9%。构建在具有全球分布式边缘缓存的云原生微服务之上,以确保超低延迟响应时间。
所有系统均可运行