ipgeolocation's free Timezone API provides time and date related information such as current time, date in various formats, week, month, year, time in unix timestamp, UTC/GMT offset and day light saving time from timezone name, any IPv4 or IPv6 address or geolocation coordinates in REST, JSON and XML format over secure HTTPS connection.
Detailed timezone data consists of current time, date in various date formats, day light saving information and geolocation data(in case of ip to timezone call).
1{
2 timezone: "America/Los_Angeles",
3 timezone_offset: "-8",
4 date: "2019-05-08",
5 date_time: "2019-05-08 03:16:34",
6 date_time_txt: "Wednesday, May 08, 2019 03:16:34",
7 date_time_wti: "Wed, 08 May 2019 03:16:34 -0700",
8 date_time_ymd: "2019-05-08T03:16:34-0700",
9 date_time_unix: "1557310594.381",
10 time_24: "03:16:34",
11 time_12: "03:16:34 AM",
12 week: "19",
13 month: "05",
14 year: "2019",
15 year_abbr: "19",
16 is_dst: true,
17 dst_savings: "1",
18 }You can pass a valid time zone name as a query parameter tz to get the time zone information. Here is a curl example:
1{
2 timezone: "America/Los_Angeles",
3 timezone_offset: "-8",
4 date: "2019-05-08",
5 date_time: "2019-05-08 03:16:34",
6 date_time_txt: "Wednesday, May 08, 2019 03:16:34",
7 date_time_wti: "Wed, 08 May 2019 03:16:34 -0700",
8 date_time_ymd: "2019-05-08T03:16:34-0700",
9 date_time_unix: "1557310594.381",
10 time_24: "03:16:34",
11 time_12: "03:16:34 AM",
12 week: "19",
13 month: "05",
14 year: "2019",
15 year_abbr: "19",
16 is_dst: true,
17 dst_savings: "1",
18 }You can pass the latitude and longitude of a location as query parameters to get the timezone information. Here is a curl example:
1{
2 timezone: "Australia/Brisbane",
3 timezone_offset: "10",
4 date: "2019-05-09",
5 date_time: "2019-05-09 16:19:51",
6 date_time_txt: "Thursday, May 09, 2019 16:19:51",
7 date_time_wti: "Thu, 09 May 2019 16:19:51 +1000",
8 date_time_ymd: "2019-05-09T16:19:51+1000",
9 date_time_unix: "1557382791.6194",
10 time_24: "16:19:51",
11 time_12: "04:19:51 PM",
12 week: "19",
13 month: "05",
14 year: "2019",
15 year_abbr: "19",
16 is_dst: false,
17 dst_savings: "0",
18 }You can pass any IPv4 or IPv6 address as a query parameter to get the regional time zone information. Here is a curl example:
1{
2 geo: {
3 ip: "Asia/Karachi",
4 country_code2: "US",
5 country_code3: "USA",
6 country_name: "United States",
7 state_prov: "California",
8 district: "Santa Clara County",
9 city: "Mountain View",
10 zipcode: "94041",
11 latitude: "37.42290",
12 longitude: "-122.08500",
13 },
14 timezone: "America/Los_Angeles",
15 timezone_offset: "-8",
16 date: "2019-05-09",
17 date_time: "2019-05-09 01:05:31",
18 date_time_txt: "Thursday, May 09, 2019 01:05:31",
19 date_time_wti: "Thu, 09 May 2019 01:05:31 -0700",
20 date_time_ymd: "2019-05-09T01:05:31-0700",
21 date_time_unix: "1557389131.428",
22 time_24: "01:05:31",
23 time_12: "01:05:31 AM",
24 week: "19",
25 month: "05",
26 year: "2019",
27 year_abbr: "19",
28 is_dst: true,
29 dst_savings: "1",
30 }You can retrieve the geolocation information for an IP address in the following languages:
Build an application for Travellers who move a lot between different timezones! Use the timezone API to keep them up-to-date and up-to-time always, no matter how many time zones they have skip over.
Make sure you know which part of the world your buyers are coming from and show them the right message at the(ir) right time.
For teams that work from all over the globe, make communications a piece of cake using our free time zone API.
Time zone API provides current time, date, and time zone related information. It can be consumed with the foloowing input variations:
In each variation of the time zone API, response remains same. Here are the details to consume each variation of the time zone API.
You can pass a valid time zone name as a query parameter tz to get the time zone information. Here is a curl exmaple:
1{
2"timezone": "America/Los_Angeles",
3"timezone_offset": -8,
4"date": "2018-12-06",
5"date_time": "2018-12-06 02:02:09",
6"date_time_txt": "Thursday, December 06, 2018 02:02:09",
7"date_time_wti": "Thu, 06 Dec 2018 02:02:09 -0800",
8"date_time_ymd": "2018-12-06T02:02:09-0800",
9"date_time_unix": 1544090529.989,
10"time_24": "02:02:09",
11"time_12": "02:02:09 AM",
12"week": "49",
13"month": "12",
14"year": "2018",
15"year_abbr": "18",
16"is_dst": false,
17"dst_savings": 1
18}You can pass any address of a location as the query parameter to get the time zone information. Here is a curl example:
1{
2"geo": {
3"country": "United Kingdom",
4"state": "England",
5"city": "London",
6"latitude": 51.505182,
7"longitude": -0.0999387
8},
9"timezone": "Europe/London",
10"timezone_offset": 0,
11"date": "2020-12-21",
12"date_time": "2020-12-21 13:17:59",
13"date_time_txt": "Monday, December 21, 2020 13:17:59",
14"date_time_wti": "Mon, 21 Dec 2020 13:17:59 +0000",
15"date_time_ymd": "2020-12-21T13:17:59+0000",
16"date_time_unix": 1608556679.524,
17"time_24": "13:17:59",
18"time_12": "01:17:59 PM",
19"week": "52",
20"month": "12",
21"year": "2020",
22"year_abbr": "20",
23"is_dst": false,
24"dst_savings": 1
25}You can pass the latitude and longitude of a location as query parameters to get the time zone information. Here is a curl example:
1{
2"timezone": "Australia/Brisbane",
3"timezone_offset": 10,
4"date": "2020-12-21",
5"date_time": "2020-12-21 23:49:16",
6"date_time_txt": "Monday, December 21, 2020 23:49:16",
7"date_time_wti": "Mon, 21 Dec 2020 23:49:16 +1000",
8"date_time_ymd": "2020-12-21T23:49:16+1000",
9"date_time_unix": 1608558556.584,
10"time_24": "23:49:16",
11"time_12": "11:49:16 PM",
12"week": "52",
13"month": "12",
14"year": "2020",
15"year_abbr": "20",
16"is_dst": false,
17"dst_savings": 0
18}You can pass any IPv4 or IPv6 address as a query parameter to get the regional timezone information. Here is a curl example:
1{
2"geo": {
3"ip": "1.1.1.1",
4"country_code2": "AU",
5"country_code3": "AUS",
6"country_name": "Australia",
7"state_prov": "Queensland",
8"district": "South Brisbane",
9"city": "Brisbane",
10"zipcode": "4101",
11"latitude": "-27.47561",
12"longitude": "153.01537"
13},
14"timezone": "Australia/Brisbane",
15"timezone_offset": 10,
16"date": "2020-12-21",
17"date_time": "2020-12-21 23:49:42",
18"date_time_txt": "Monday, December 21, 2020 23:49:42",
19"date_time_wti": "Mon, 21 Dec 2020 23:49:42 +1000",
20"date_time_ymd": "2020-12-21T23:49:42+1000",
21"date_time_unix": 1608558582.413,
22"time_24": "23:49:42",
23"time_12": "11:49:42 PM",
24"week": "52",
25"month": "12",
26"year": "2020",
27"year_abbr": "20",
28"is_dst": false,
29"dst_savings": 0
30}Note: When you get the time zone information through an IP address, API will also return the 'geo' field along with the time zone information.
You can call the time zone API without passing any time zone, coordinates or IP address as well. It will use the calling machine's IP address to return the regional time zone information. Here is a curl example:
This variation is widely used on embedded hardware and IoT to get current time after reboot.
Note:In above examples, we used API Key everywhere. Time zone API can be called from client side JavaScript with Request Origin authentication as well on paid plans.
The geolocation information in the response from Time zone API when called using an IP address, can be retreived in the following languages:
By default, the API responds in English. You can change the response language by passing the language code as a query parameter lang. Here are a few curl examples:
Note: Multi language feature is available only for paid users.
You can convert a provided timestamp from one time zone to another time zone. You can convert the provided timestamp in three ways:
1{
2"original_time": "2020-12-08 11:00",
3"converted_time": "2020-12-08 18:30",
4"diff_hour": 7.5,
5"diff_min": 450
6}1{
2"original_time": "2020-12-08 11:00",
3"converted_time": "2020-12-08 18:30",
4"diff_hour": 7.5,
5"diff_min": 450
6}1{
2"original_time": "2020-12-08 06:00",
3"converted_time": "2020-12-08 16:00",
4"diff_hour": 9,
5"diff_min": 540
6} Note: time=2020-12-08%2006:00 parameter takes the input in the following two formats: i) 'yyyy-MM-dd HH:mm', and ii) 'yyyy-MM-dd HH:mm:ss'. This parameter is optional and you can omit it to convert the current time between two coordinates or locations.