Date difference

Count elapsed calendar days between two dates in either direction.

Gregorian civil dates from years 0001 to 9999, without time or timezone. The same date gives 0 days; an earlier end date gives a negative result. No inclusive counting or business-day calculation. Example: February 28 to March 1, 2024 = 2 days.

Your dates and times stay in your browser and are not stored.

Method and assumptions

Method version 1.0.0 · Updated

Elapsed days

Formula: End date − start date

Gregorian civil dates from years 0001 to 9999, without time or timezone. The same date gives 0 days; an earlier end date gives a negative result. No inclusive counting or business-day calculation. Example: February 28 to March 1, 2024 = 2 days.

start
Start date
end
End date

Gregorian calendar from years 0001 to 9999. Date, duration and rounding conventions are specified for each mode.

Calculate with code

These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.

JavaScript
const days = (Date.UTC(2026, 0, 10) - Date.UTC(2026, 0, 1)) / 86_400_000;
console.log(days); // 9
TypeScript
const days: number = (Date.UTC(2026, 0, 10) - Date.UTC(2026, 0, 1)) / 86_400_000;
console.log(days); // 9
Python
from datetime import date
print((date(2026, 1, 10) - date(2026, 1, 1)).days)  # 9
Java
var start = java.time.LocalDate.of(2026, 1, 1);
var end = java.time.LocalDate.of(2026, 1, 10);
System.out.println(java.time.temporal.ChronoUnit.DAYS.between(start, end)); // 9
C#
var start = new DateOnly(2026, 1, 1);
var end = new DateOnly(2026, 1, 10);
Console.WriteLine(end.DayNumber - start.DayNumber); // 9