A Simple Flask Time API to get real-time time information without any third-party API.
- Highly Customizable
- Get Comprehensive List Of Time Data Such As:
- Milliseconds
- Seconds
- Minutes
- Hour
- Day
- Month
- Year
- Date & Many More
- Supports 500+ World Time Zones
- Can be easily integrated with Android, Web, or any project via a simple HTTP request.
TimeServer Is Live On Render
To get started with Time Server on your local machine, follow these steps:
Make sure you have Git and Python installed:
git --version
python --version
Clone The Repository
git clone https://github.com/BirukBelihu/TimeServer.git
Go Inside The Project
cd TimeServer
Install Required Dependencies
pip install -r requirements.txt
Start The Time Server
python main.py
If You're Calling The API From External Clients(Android Or Web) Don't Forget To Expose The Port Using Ngrok.
ngrok http 5000
N.B Replace 5000 With Your Own PORT If You're Using Different Port Number.
Sample Request Using cURL
curl http://IP_ADDRESS:PORT/api/v1/time/current/zone?timeZone=Africa/Addis_Ababa
Response
{
"date": "03/04/2025",
"dateTime": "2025-04-03T19:52:05.599935+03:00",
"day": 3,
"dayOfWeek": "Thursday",
"dstActive": false,
"hour": 19,
"milliSeconds": 599,
"minute": 52,
"month": 4,
"seconds": 5,
"time": "19:52",
"timeZone": "Africa/Addis_Ababa",
"year": 2025
}
Get All The Available Time Zones
curl http://IP_ADDRESS:PORT/api/v1/time/current/zone/timeZones
Response
[
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"Africa/Algiers",
"Africa/Asmara",
"Africa/Asmera",
"Africa/Bamako",
"Africa/Bangui",
"Africa/Banjul",
...
]
Get Server Status
http://IP_ADDRESS:PORT/api/v1/status
Run Tests Using Pytest
pytest test_server.py
To Run TimeServer In Docker Container Follow This Steps.
Build Docker Image
docker build -t timeserver .
Run The Server
docker run -p 5000:5000 timeserver
The Rest Of The Steps Are Same
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.