World Time API
worldtimeapi · Location
A simple API to get the current time based on a request with a timezone.
Authentication
Sample Requests
request the current time based on the ip of the request. note: this is a "best guess" obtained from open-source data.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip"
import requests
response = requests.get(
"https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip",
)
print(response.json())const url = 'https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));request the current time based on the ip of the request. note: this is a "best guess" obtained from open-source data.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip.txt"
import requests
response = requests.get(
"https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip.txt",
)
print(response.json())const url = 'https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip.txt'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip.txt"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip.txt")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/ip.txt";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));a listing of all timezones.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/timezone"
import requests
response = requests.get(
"https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/timezone",
)
print(response.json())const url = 'https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/timezone'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/timezone"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/timezone")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/worldtimeapi.org/20210108/timezone";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with World Time API?
World Time API is a Location API. Developers commonly use location APIs for:
- tracking assets and vehicles in real time
- building delivery and logistics apps
- finding nearby businesses or services
- geo-fencing and location-based notifications
- address validation and autocomplete
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. World Time API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide