AnyDate API v1.0

Universal Date & Time Parsing

Transform any date format into structured, timezone-aware timestamps

AnyDate API intelligently parses dates from natural language, ISO formats, Unix timestamps, and localized inputs. Built with FastAPI, dateparser, and parsedatetime for maximum compatibility and accuracy across languages, timezones, and formats.

What This API Does

🌍 Natural Language

Parse "next Monday 8am", "maΓ±ana 5pm", "in 2 hours" in multiple languages

πŸ• Timezone Magic

Convert between any timezone with DST awareness and IANA support

πŸ“… Format Flexibility

Accept ISO dates, Unix timestamps, and return custom strftime formats

🌏 Locale Support

Parse dates in Spanish, French, German, Hindi, and dozens more languages

Quick Start

2 endpoints

GET /parse?input=... β€” Quick tests and browser-friendly queries

curl "http://127.0.0.1:8000/parse?input=tomorrow%208am&output_timezone=UTC"

POST /parse β€” JSON body for complex parameters

curl -X POST "http://127.0.0.1:8000/parse" \
        -H "Content-Type: application/json" \
        -d '{"input":"2025-08-09"}'

Parameters

Parameter Type Required Description
input string Required Any date/time text: ISO, Unix timestamp, natural language
input_timezone string Optional IANA zone (Asia/Kolkata), abbreviation (IST), or offset (UTC+05:30)
output_timezone string Optional Convert result to this timezone
locale string Optional Language code (en, es, fr, de, etc.) for natural language parsing
output_formats string | array Optional One or multiple strftime format strings

Sample API Response

JSON

Here's what a successful API response looks like with all available fields:

{
  "success": true,
  "iso_utc": "2025-08-15T17:00:00+00:00",
  "iso_output_timezone": "2025-08-15T22:30:00+05:30",
  "unix_timestamp": 1755277200,
  "human_readable": "15 August 2025, 10:30 PM IST",
  "custom_formats": {
    "%Y-%m-%d": "2025-08-15",
    "%H:%M %p": "22:30 PM"
  },
  "components": {
    "year": 2025,
    "month": 8,
    "day": 15,
    "weekday": "Friday",
    "hour": 22,
    "minute": 30,
    "second": 0,
    "timezone": "IST",
    "utc_offset": "+0530",
    "day_of_year": 227,
    "week_of_year": 33,
    "quarter": 3,
    "is_weekend": false,
    "is_weekday": true,
    "am_pm": "PM",
    "is_leap_year": false
  },
  "input_locale_detected": null,
  "input_original": "next friday 6pm"
}

Response Fields Explained

Core Fields
  • success β€” Always true for valid responses
  • iso_utc β€” ISO format in UTC timezone
  • iso_output_timezone β€” ISO in requested timezone
  • unix_timestamp β€” Unix epoch seconds
  • human_readable β€” Friendly display format
Custom & Components
  • custom_formats β€” Your strftime formats
  • components β€” Broken down date parts
  • input_locale_detected β€” Detected language
  • input_original β€” Your original input

Basic Examples

1. Basic Date Parsing (GET)

Parse a simple date string in ISO format

curl "http://127.0.0.1:8000/parse?input=2025-08-09"
2. Basic Parsing (POST)

Same as above but via POST with JSON body

curl -X POST "http://127.0.0.1:8000/parse" \
-H "Content-Type: application/json" \
-d '{"input":"2025-08-09"}'
3. Timezone Conversion

Parse with input timezone and convert to different output timezone

curl "http://127.0.0.1:8000/parse?input=2025-08-09%2014:00&input_timezone=Asia/Kolkata&output_timezone=UTC"
4. Natural Language (English)

Parse relative English phrases

curl "http://127.0.0.1:8000/parse?input=next%20monday%208am"
5. Natural Language (Spanish)

Parse Spanish phrases with locale specification

curl "http://127.0.0.1:8000/parse?input=maΓ±ana%205pm&locale=es"
6. Unix Timestamps

Parse Unix epoch (10 digits = seconds, 13 digits = milliseconds)

curl "http://127.0.0.1:8000/parse?input=1733808000"

Advanced Examples

Custom Output Formats

Return multiple custom formatted strings

curl -X POST "http://127.0.0.1:8000/parse" \
-H "Content-Type: application/json" \
-d '{"input":"2025-08-09 14:00","output_formats":["%Y-%m-%d","%A","%B %d, %Y at %I:%M %p"]}'
Complex Multi-Parameter

Demonstrates all major parameters in one request

curl -X POST "http://127.0.0.1:8000/parse" \
-H "Content-Type: application/json" \
-d '{"input":"next friday 6pm","locale":"en","input_timezone":"Europe/London","output_timezone":"Asia/Kolkata","output_formats":["%Y-%m-%d","%H:%M %p"]}'
ISO with Offset Parsing

Parse ISO datetime with timezone offset and convert

curl "http://127.0.0.1:8000/parse?input=2025-08-09T14:30:00%2B05:30&output_timezone=UTC"

Error Codes

All errors return with HTTP 400 and follow this structure:

{"success": false, "error_code": "ERROR_CODE", "message": "Human readable message", "input_original": "user_input"}
INVALID_DATE_FORMAT

The input string couldn't be parsed as a valid date/time by any method

INVALID_TIMEZONE

The specified timezone is not recognized or invalid

AMBIGUOUS_TIMEZONE

Timezone abbreviation matches multiple zones (e.g., CST could be Central Standard Time in US or China)

RATE_LIMIT_EXCEEDED

You've exceeded the allowed request rate for your IP address

INTERNAL_ERROR

Unexpected server-side error during processing

INVALID_OUTPUT_FORMAT

One or more of the provided strftime format strings is invalid

Rate Limits

50
requests per minute
5
requests per second

Why These Limits?

Date parsing involves complex natural language processing and timezone calculations. These limits ensure:

  • Fair usage β€” Prevents individual users from overwhelming the service
  • Performance β€” Maintains sub-200ms response times for all users
  • Resource efficiency β€” Allows the API to handle high-quality parsing without degradation
  • Abuse prevention β€” Stops automated scraping or excessive polling

Rate limits are applied per IP address.

πŸš‚ Hosted on Railway

This API is currently hosted on Railway's free tier, which comes with resource limitations. The current rate limits help ensure the service stays available for everyone within these constraints.

β˜• Help Improve the Service

Your donations help cover server costs and allow me to upgrade to higher limits and dedicated infrastructure. Every coffee makes a difference! πŸ™

Frequently Asked Questions

How accurate is natural language parsing?
Very high for English and common phrases. The API uses dateparser (40+ languages) with parsedatetime as fallback. Accuracy improves when you specify the correct locale parameter.
Why does PST become PDT in results?
The API respects Daylight Saving Time rules. PST automatically becomes PDT during summer months. Use fixed offsets like "UTC-08:00" if you need to avoid DST adjustments.
Which timezone abbreviations are supported?
Common ones like UTC, GMT, EST, PST, IST work reliably. Ambiguous abbreviations (CST, IST) may return an AMBIGUOUS_TIMEZONE error with suggestions. IANA zone names (America/New_York) are always preferred.
Can I parse multiple dates in one request?
No, each request parses one date input. For bulk processing, make multiple parallel requests within rate limits.
How do I import curl examples into Postman?
Copy any curl command, then in Postman: Import β†’ Raw text β†’ paste the curl command β†’ Import. Postman will automatically convert it to a proper request.
What's the difference between 10-digit and 13-digit timestamps?
10 digits = Unix seconds since epoch (1970-01-01). 13 digits = Unix milliseconds. The API automatically detects and handles both formats.
Does the API work with relative dates like "2 weeks ago"?
Yes! Relative phrases work well in English. For other languages, provide the locale parameter for better accuracy.
What happens with invalid or empty input?
You'll receive an INVALID_DATE_FORMAT error with details about why the parsing failed. The API never returns guessed or default dates.