Relative Time Formatter API

GET

Replace raw timestamps with readable phrases like 2 hours ago.

Relative Time Formatter converts Unix timestamps and ISO dates into readable relative time phrases. Choose between short, long, or abbreviated styles to get humanized past or future strings, millisecond differences, and unit breakdowns from seconds to years.

Try it — live request, no key required

Request
GETapi.apiverve.com/v1/relativetimeformatter?timestamp=1609459200
Query parameters
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "target_date": "2021-01-01T00:00:00Z",
    "reference_date": "2025-12-16T22:28:24.459Z",
    "relative_time": "4 years ago",
    "is_past": true,
    "is_future": false,
    "difference_ms": -156464904459,
    "primary_unit": "year",
    "primary_value": 4,
    "all_units": {
      "years": 4,
      "months": 59,
      "weeks": 258,
      "days": 1810,
      "hours": 43462,
      "minutes": 2607748,
      "seconds": 156464904,
      "milliseconds": 156464904459
    },
    "style": "short"
  }
}

About the Relative Time Formatter API

Relative Time Formatter works by calculating the time difference between dates and expressing it in the most appropriate unit (seconds, minutes, hours, days, weeks, months, years) with customizable formatting styles.

What people use it for

Social Media
Display post timestamps as relative times like '5 minutes ago' in feeds and timelines
Activity Logs
Show user activity and system events with human-readable time references
Notifications
Format notification timestamps for better user comprehension and engagement
Analytics
Present time-based data and metrics in accessible relative time formats

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use Relative Time Formatter

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the Relative Time Formatter API.

Read the docs →
Does the API accept both Unix timestamps and standard ISO date strings?
Yes. There are dedicated endpoints for both formats. You can pass Unix timestamps in either seconds or milliseconds, or provide full ISO date strings directly.
Can I calculate relative time against a specific reference date instead of right now?
Yes. By default, the API compares your date against the current moment, but you can pass an optional reference parameter with any timestamp or date. This lets you calculate the relative interval between two historical events or fixed points in time.
Do I get numerical time breakdowns in addition to the formatted text?
Yes. Alongside the formatted text string, every response returns the total time gap in milliseconds, the primary unit and value used, and an all-units object containing the exact difference broken down into milliseconds, seconds, minutes, hours, days, weeks, months, and years.
How does the API handle dates that occur in the future?
The API handles future dates automatically, generating forward-looking phrases such as in 3 days. The response also includes boolean flags for is_future and is_past, allowing your application logic to determine whether an event has already occurred without manual date math.
What would formatting 50,000 timestamps a month cost me?
Each call to Relative Time Formatter costs 2 credits. Formatting 50,000 timestamps uses 100,000 credits, which fits well within the Starter plan's 200,000 monthly credits. That volume works out to about $0.30 per 1,000 calls. The Free plan includes 100 calls per month.

Ready to build with Relative Time Formatter? Start with 200 free credits — one key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs