A simple and efficient REST API for fetching current time information with timezone support.
GitHub Repository: https://github.com/petstack/time-api
GET /v1/time?timezone={timezone}
Parameters:
timezone (optional): Timezone to get the time for (e.g., 'UTC', 'Europe/London'). Defaults to 'UTC'.Example Response:
{
"timestamp": 1634567890,
"time": "10:13:44.323435",
"date": "2021-10-18",
"timezone": "UTC",
"abbr": "GMT",
"offset": "+00:00",
"iso8601": "2021-10-18T10:13:44+00:00"
}
GET /v1/timezones
Example Response:
{
"timezones": [
{
"name": "Africa/Abidjan",
"abbr": "GMT"
},
{
"name": "Africa/Accra",
"abbr": "GMT"
},
{
"name": "Europe/London",
"abbr": "BST"
}
// ... more timezones
]
}
GET /v1/openapi.json
Returns the OpenAPI specification for the API.
All API endpoints support Cross-Origin Resource Sharing (CORS) for GET requests. The following CORS headers are included in all GET responses:
Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET Access-Control-Allow-Headers: Content-Type
This allows the API to be accessed from any domain using GET requests.