# Date Calculator API

> Date Calculator computes the difference between two calendar dates in minutes, hours, days, weeks, months, and years. Supply start and end dates in YYYY-MM-DD format to receive exact interval breakdowns.

**Endpoint:** `GET https://api.apiverve.com/v1/datecalculator`  
**Category:** Calendar  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/datecalculator

## Overview

Date Calculator works by analyzing the dates provided and calculating the date difference. It uses advanced algorithms to calculate the date difference based on the dates and returns the calculated date difference.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/datecalculator?start=2022-01-01&end=2022-12-31" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `start` | string | Yes | The start date for calculating the difference (format: YYYY-MM-DD). date |
| `end` | string | Yes | The end date for calculating the difference (format: YYYY-MM-DD). date |

## Response fields

- `minutes` — number · Total number of minutes between start and end dates
- `hours` — number · Total number of hours between start and end dates (a running total, not a remainder; see exact)
- `days` — number · Total number of days between start and end dates (a running total, not a remainder; see exact)
- `weeks` — number · Total number of weeks between start and end dates (a running total, not a remainder; see exact)
- `months` — number · Total number of months between start and end dates (a running total, not a remainder; see exact)
- `years` — number · Total number of years between start and end dates
- `start` — object · The start date, broken into its formatted parts
  - `start.date` — string · Formatted start date in YYYY-MM-DD format
  - `start.day` — string · Day of week name for the start date · (premium)
  - `start.month` — string · Month name for the start date · (premium)
  - `start.year` — string · Year for the start date
  - `start.words` — string · Human-readable formatted start date with day and month · (premium)
- `end` — object · The end date, broken into its formatted parts
  - `end.date` — string · Formatted end date in YYYY-MM-DD format
  - `end.day` — string · Day of week name for the end date · (premium)
  - `end.month` — string · Month name for the end date · (premium)
  - `end.year` — string · Year for the end date
  - `end.words` — string · Human-readable formatted end date with day and month · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "minutes": 524160,
    "hours": 8736,
    "days": 364,
    "weeks": 52,
    "months": 11,
    "years": 0,
    "start": {
      "date": "2022-01-01",
      "day": "Saturday",
      "month": "January",
      "year": "2022",
      "words": "Saturday, January 1st 2022"
    },
    "end": {
      "date": "2022-12-31",
      "day": "Saturday",
      "month": "December",
      "year": "2022",
      "words": "Saturday, December 31st 2022"
    }
  }
}
```

## Use cases

- **Billing Cycle Tracking** — Subscription management platforms calculate elapsed days and months between customer signup dates and renewal periods to generate accurate prorated invoices.
- **Milestone Deadline Tracking** — When managing sprint deadlines, engineering tools track remaining weeks and days against delivery targets to flag overdue milestones.
- **Hotel Stay Calculation** — Booking engines compute total nights and days between check-in and check-out dates to present stay lengths and determine nightly rate totals.
- **Insurance Policy Eligibility** — To determine policy eligibility, insurance portals calculate the total years and months between an incident date and policy inception.

## SDKs

- **npm** — `npm install @apiverve/datecalculator` (https://www.npmjs.com/package/@apiverve/datecalculator)
- **PyPI** — `pip install apiverve-datecalculator` (https://pypi.org/project/apiverve-datecalculator/)
- **NuGet** — `dotnet add package APIVerve.API.DateCalculator` (https://www.nuget.org/packages/APIVerve.API.DateCalculator)
- **Source** — https://github.com/apiverve/datecalculator-api

## More

- Full reference: https://docs.apiverve.com/ref/datecalculator
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
