Date Span Calculator

Use this Date Span Calculator to Find the Duration Between Any Two Given Dates.

Date Span Calculator

Date Span

Easily Calculate the duration between two dates.

A date span calculator is an online date calculator tool that calculates the total duration between any two given dates. It helps you find out how much time has been passed between two dates in different time formats (seconds, minutes, hours, days, months, and years).

The date span calculator is mostly used in the following cases:

  • Loan duration calculations
  • Anniversary calculations
  • Project timeline calculations
  • Countdown timers
  • Client billing calculations

Date Span Formula

The following formula is used to find the duration between two dates:

Date Span = Later Date - Earlier Date

How to Calculate Date Span?

Step 1: Get dates from the user and convert it into JavaScript date objects

const startDate = new Date("2024-04-23");
const endDate = new Date("2024-04-23");

Step 2: Subtract the two dates to get the difference in milliseconds

const ms = endDate - startDate;

Step 3: Convert the total duration (milliseconds) to other units

const seconds = ms/1000;
const minutes = seconds/60;
const hours = minutes/60;
const days = hours/24;
const weeks = days/7;
const months = days/30.44;
const years = days/365.25;

Solved Examples

Example 1: Find the date span between 21 April 2025 to 30 April 2025.

Start Date = 21 April 2025

End Date = 30 April 2025

Date Span = End Date - Start Date = 9 Days

Thus, there are total 9 days between 21 April 2025 and 30 April 2025.