Welcome to the Time API. This API allows you to retrieve detailed information about the current date and time for a specific timezone.
Endpoint | Description |
---|---|
https://time.ildiamantedisl.com/:region/:city |
Returns JSON data with detailed time information for the specified timezone (e.g., https://time.ildiamantedisl.com/Europe/Rome ). |
The API returns a JSON object with the following fields:
Field | Type | Description |
---|---|---|
utc_offset |
string | The UTC offset of the timezone, e.g., +01:00 . |
timezone |
string | The full timezone identifier, e.g., Europe/Rome . |
day_of_week |
integer | The current day of the week (0 = Sunday, 6 = Saturday). |
day_of_year |
integer | The current day of the year, e.g., 354 for December 19. |
datetime |
string | The current local date and time in ISO 8601 format, including the timezone offset. |
utc_datetime |
string | The current date and time in UTC, in ISO 8601 format. |
unixtime |
integer | The current timestamp in seconds since the Unix epoch. |
raw_offset |
integer | The timezone offset from UTC in seconds. |
week_number |
integer | The current week number of the year, according to ISO standards. |
dst |
boolean | Indicates whether Daylight Saving Time (DST) is currently in effect. |
abbreviation |
string | The abbreviation of the timezone, e.g., CET . |
client_ip |
string | The IP address of the client making the request. |
{
"utc_offset": "+01:00",
"timezone": "Europe/Rome",
"day_of_week": 4,
"day_of_year": 354,
"datetime": "2024-12-19T17:11:24.678261+01:00",
"utc_datetime": "2024-12-19T16:11:24.678261+00:00",
"unixtime": 1734624684,
"raw_offset": 3600,
"week_number": 51,
"dst": false,
"abbreviation": "CET",
"client_ip": "151.149.215.116"
}
To use the API, simply make a GET
request to the endpoint with the desired region and city. For example:
GET /Europe/Rome
This will return the current time information for Rome in JSON format.
Here is an example of how to use the API with the fetch
method in JavaScript:
// Example: Fetching data from /Europe/Rome endpoint
fetch("https://time.ildiamantedisl.com/Europe/Rome")
.then(response => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then(data => {
console.log("Time data:", data);
// Display data in the browser or process it further
})
.catch(error => {
console.error("Fetch error:", error);
});
For more information, contact @ildiamantedisl (Discord) administrator of this API.