FastAPI DateTime Service
This is a simple FastAPI application that provides an OpenAPI-compatible /datetime
endpoint returning the current date, time, weekday, and calendar week.
Requirements
- Python 3.7+
- FastAPI
- Uvicorn
pip install -r requirements.txt
Running the Application
To start the FastAPI server, run:
python main.py
The server will be available at http://localhost:8000
.
Endpoints
GET /datetime
Returns current date, time, weekday, and calendar week.
Response Format:
{
"date": "2025-09-22",
"time": "14:30:45",
"weekday": "Monday",
"calendar_week": 38
}
Response Fields:
date
(string): Current date in YYYY-MM-DD formattime
(string): Current time in HH:MM:SS formatweekday
(string): Full weekday name (e.g., "Monday")calendar_week
(integer): ISO calendar week number
Description
Languages
Python
75.4%
Dockerfile
24.6%