Converts timestamps into human-readable relative time descriptions like "2 days ago" or "in 3 hours". Use via MCP in Cursor or Windsurf for natural time formatting in AI workflows, or call GET /v1/datetime/relative with your timestamp. Returns consistent, localized descriptions that match user expectations. Perfect for chat interfaces, logs, and activity feeds where absolute timestamps feel robotic.
curl "https://tinyfn.io/v1/datetime/relative" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/datetime/relative', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/datetime/relative',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's date/time tools:
{
"mcpServers": {
"tinyfn-datetime": {
"url": "https://tinyfn.io/mcp/datetime",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Pass your timestamp to the relative time tool in your MCP-enabled editor. It returns descriptions like '5 minutes ago', 'tomorrow', or 'last week' based on the current time.
Accepts ISO 8601 strings, Unix timestamps (seconds or milliseconds), and standard date formats. The API normalizes input automatically.
Yes, future timestamps return forward-looking descriptions like 'in 2 hours', 'next week', or 'in 6 months'. Past dates use backward descriptions like 'yesterday' or '3 days ago'.
Returns contextually appropriate precision: seconds for very recent times, minutes/hours for same day, days for recent weeks, then months/years for older dates.
The tool returns standard English descriptions optimized for readability. For custom formats or localization, you'd need to process the output or use additional formatting tools.
Get your free API key and start using Relative Time in seconds.
Get Free API Key