Base URL
Endpoints Overview
Method | Endpoint | Description |
---|---|---|
GET | /time/ | Process time operations with query parameters |
POST | /time/ | Process time operations with JSON body |
GET /time/
Process time operations using query parameters.Query Parameters
Parameter | Type | Default | Description |
---|---|---|---|
operation | string | current | Operation to perform |
timezone | string | UTC | Timezone for current time |
timestamp | integer | none | Unix timestamp |
datetime | string | none | Datetime string |
start | string | none | Start datetime for difference |
end | string | none | End datetime for difference |
amount | integer | none | Amount to add/subtract |
unit | string | none | Time unit (seconds, minutes, hours, days, weeks, months, years) |
from_timezone | string | none | Source timezone for conversion |
to_timezone | string | none | Target timezone for conversion |
Supported Operations
Time Information
Operation | Description | Required Parameters | Example |
---|---|---|---|
current | Get current time information | timezone (optional) | Current time in specified timezone |
timezones | List available timezones | None | All supported timezones |
Time Calculations
Operation | Description | Required Parameters | Example |
---|---|---|---|
difference | Calculate time difference | start , end | Days between two dates |
add | Add time to datetime | datetime , amount , unit | Add 7 days to date |
subtract | Subtract time from datetime | datetime , amount , unit | Subtract 2 hours from time |
Timezone Operations
Operation | Description | Required Parameters | Example |
---|---|---|---|
convert_timezone | Convert between timezones | datetime , from_timezone , to_timezone | Convert NY time to London |
timezone_info | Get timezone information | timezone | Info about specific timezone |
Example Requests
Current Time
Time Difference
Add Time
Timezone Conversion
Response Formats
Current Time Response
Time Difference Response
Timezone Conversion Response
POST /time/
Process time operations using JSON body parameters.Request Body
Example Request
Response Fields
Current Time Response Fields
Field | Type | Description |
---|---|---|
operation | string | Operation performed |
timestamp | integer | Unix timestamp |
datetime | string | Formatted datetime |
date | string | Date portion (YYYY-MM-DD) |
time | string | Time portion (HH:MM:SS) |
timezone | string | Timezone used |
unix_timestamp | integer | Unix timestamp |
iso8601 | string | ISO 8601 format |
rfc2822 | string | RFC 2822 format |
year | string | Year |
month | string | Month (01-12) |
day | string | Day (01-31) |
hour | string | Hour (00-23) |
minute | string | Minute (00-59) |
second | string | Second (00-59) |
day_of_week | string | Day name |
day_of_year | string | Day of year (001-366) |
week_of_year | string | Week of year (01-53) |
is_leap_year | boolean | Whether it’s a leap year |
timezone_offset | string | Timezone offset |
Time Difference Response Fields
Field | Type | Description |
---|---|---|
operation | string | Operation performed |
start | string | Start datetime |
end | string | End datetime |
difference.total_seconds | integer | Total seconds difference |
difference.total_minutes | integer | Total minutes difference |
difference.total_hours | integer | Total hours difference |
difference.total_days | integer | Total days difference |
difference.total_weeks | integer | Total weeks difference |
difference.formatted | string | Human-readable difference |
Error Responses
Missing Required Parameters (400)
Invalid Datetime Format (400)
Invalid Timezone (400)
Invalid Time Unit (400)
HTTP Status Codes
Code | Description |
---|---|
200 | Success - Time operation completed |
400 | Bad Request - Invalid parameters |
500 | Internal Server Error |
Rate Limits
No rate limits! You can make unlimited requests to our API.Datetime Format Support
Input Formats
The API accepts various datetime formats:- ISO 8601:
2024-01-15T10:30:00Z
- Date Only:
2024-01-15
- Date and Time:
2024-01-15 10:30:00
- Unix Timestamp:
1705312200
- RFC 2822:
Mon, 15 Jan 2024 10:30:00 -0500
- Natural Language:
tomorrow
,next week
,in 2 hours
Output Formats
All responses include multiple datetime formats:- ISO 8601: Standard international format
- RFC 2822: Email-friendly format
- Unix Timestamp: Numeric timestamp
- Formatted: Human-readable format
Timezone Handling
Supported Timezones
The API supports all standard timezone identifiers:- Continental:
America/New_York
,Europe/London
,Asia/Tokyo
- UTC Variants:
UTC
,UTC+5
,UTC-8
- Abbreviations:
EST
,PST
,GMT
(when unambiguous)
Timezone Conversions
When converting between timezones:- Handles daylight saving time automatically
- Preserves the exact moment in time
- Provides offset information
- Supports historical timezone changes
Time Units
Supported Units
Unit | Description | Example |
---|---|---|
seconds | 1 second | Add 30 seconds |
minutes | 60 seconds | Add 15 minutes |
hours | 3600 seconds | Add 2 hours |
days | 86400 seconds | Add 7 days |
weeks | 604800 seconds | Add 2 weeks |
months | Variable (28-31 days) | Add 3 months |
years | Variable (365-366 days) | Add 1 year |
Unit Handling
- Fixed Units: seconds, minutes, hours, days, weeks
- Variable Units: months, years (account for leap years, month lengths)