Time/Timezone Utilities

Subtract Time

Subtracts specified time durations from datetime values with precision handling. Use via MCP in Cursor or REST at `/v1/time/subtract`. Pass a datetime and duration (hours, minutes, seconds, etc.) to get the calculated result. Handles timezone-aware calculations and maintains ISO 8601 formatting for reliable time arithmetic in AI workflows.

API Endpoint

GET /v1/time/subtract

Code Examples

curl "https://tinyfn.io/v1/time/subtract" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/subtract', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/time/subtract',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's time/timezone tools:

{
  "mcpServers": {
    "tinyfn-time": {
      "url": "https://tinyfn.io/mcp/time",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I subtract hours and minutes from a datetime using the subtract time tool?

Pass the datetime and specify duration parameters like hours=-2 and minutes=-30. The tool returns the calculated datetime in ISO 8601 format.

Does the subtract time function handle timezone conversions properly?

Yes, it preserves timezone information in the input datetime and performs calculations relative to that timezone, maintaining accuracy across DST boundaries.

Can I subtract multiple time units simultaneously with this tool?

Yes, you can combine years, months, days, hours, minutes, and seconds in a single subtraction operation for complex time calculations.

How do MCP agents use the subtract time tool for scheduling workflows?

AI agents in Windsurf or Cline can calculate deadlines, schedule reminders, or determine time windows by subtracting durations from reference timestamps.

What happens when subtracting time results in a date before epoch or invalid date?

The tool handles edge cases gracefully, returning appropriate error messages for impossible dates while maintaining calculation accuracy for valid ranges.

Try Subtract Time Now

Get your free API key and start using Subtract Time in seconds.

Get Free API Key