تخطَّ إلى المحتوى
DevTools / حاسبة الفرق بين تاريخين

حاسبة الفرق بين تاريخين

How many days until the deadline, how many weekdays are left in the sprint, how old is this contract in years and months, what date is ninety days from today — these are simple questions with answers that are surprisingly easy to get wrong, because calendar arithmetic is not the same as subtracting two numbers. This calculator returns the difference in every unit at once, handles the year-and-month form with correct borrowing between uneven months, and counts business days with a configurable weekend and a holiday list.

تعمل بالكامل داخل المتصفح — لا يُرفع أي شيء.

Calendar difference

0 years 1 months 0 days

That is 31 days in total

Total days
31
Total weeks
4
Total months
1
Total hours
744
Total minutes
44,640
Total seconds
2,678,400
Weekdays only
—
enable below
Weekend days
0
Start weekdayFriday
End weekdayMonday
Start ISO2026-10-16T00:00:00.000Z
End ISO2026-11-16T00:00:00.000Z

كيف تعمل

There are two different questions hidden in the phrase difference between two dates. The exact elapsed duration is a fixed number of milliseconds, which divides cleanly into days, hours and minutes. The calendar difference is what a person means by three years and two months, and it depends on where the dates fall: from 31 January to 28 February is one calendar month, but so is 31 January to 3 March. This tool reports both, because a contract that runs for one calendar month and one that runs for 28 days are genuinely different agreements.

The calendar difference is computed with borrowing, the way subtraction is taught at school. When the day component of the end date is smaller than that of the start date, a month is borrowed from the month component and the number of days in the previous month is added — which is why the algorithm has to know that February 2024 had 29 days and February 2025 had 28. Getting this wrong is what produces the off-by-one-day errors that appear in billing systems and in age calculations at exactly the boundaries where they matter. A 29 February birthday, for instance, is a well-known edge case: some jurisdictions treat the person as ageing on 28 February in non-leap years and others on 1 March.

Business-day counting is arithmetic on a calendar rather than on a number line. Weekends are removed first, using a configurable mask because the working week is not Saturday and Sunday everywhere — much of the Middle East observes Friday and Saturday. Public holidays are then removed from the remaining set, taking into account that a holiday falling on a weekend does not remove an additional working day, and that substitute holidays exist in some countries to compensate. The result is the count a project manager or an SLA calculation actually needs.

Duration arithmetic in the other direction has its own traps. Adding one month to 31 January gives 28 or 29 February, not 31 February, so the day is clamped to the last valid day of the target month. Adding one year to 29 February in a leap year gives 28 February. Adding a number of days is straightforward in contrast, because a day is a fixed amount of time — except across a daylight saving transition, where the local time shifts by an hour but the date does not, which is why the arithmetic here works on calendar dates rather than on elapsed milliseconds where the question is a calendar one.

حالات الاستخدام الشائعة

  • Count the days remaining until a deadline, a renewal or a product launch.
  • Work out an exact age in years, months and days for a form or a record.
  • Count the working days in a project window, excluding weekends and public holidays.
  • Calculate a due date ninety days out for an invoice or a notice period.
  • Check whether a subscription period has elapsed in calendar months or in days.
  • Work out how long an employee has been with a company in years and months for a service award.

آخر تحديث: 2026-10-14 — يُعرض متن المقال بالإنجليزية، بينما الواجهة مترجمة.

الأسئلة الشائعة

How many days are between two dates?

Subtract the earlier date from the later one and you have the elapsed time; dividing by 86,400,000 milliseconds gives the count of days. The calculator reports this alongside the calendar difference in years, months and days, and alongside the totals in weeks, months and hours. Which figure is correct depends on the question: a 30-day notice period is thirty elapsed days, whereas a one-month notice period ends on the same day of the following month, and the two are not the same length.

Should the start date be included?

It depends on the convention you are working under, and the difference is exactly one day. Elapsed-time calculations exclude the start instant, so from Monday 09:00 to Tuesday 09:00 is one day. Many legal and business contexts count inclusively, so a three-day notice served on Monday expires on Wednesday. The calculator reports the elapsed difference; add one day if your convention is inclusive, and be explicit about which convention applies whenever a deadline is being computed.

How are holidays handled in business day counting?

You supply the dates and they are removed from the set of candidate days, but only if they fall on a weekday — a public holiday on a Saturday has already been excluded by the weekend rule and does not remove an extra working day. The list is entered by hand rather than bundled, deliberately: public holidays vary by country, by state and by year, and a built-in list would silently be wrong somewhere. Import the relevant year's official list for the jurisdiction that governs the calculation.

Why does adding one month give an unexpected date?

Because months have different lengths, so adding a month is not adding thirty days. The convention, and the one this tool follows, is to clamp: 31 January plus one month is 28 February in a common year and 29 February in a leap year, since 31 February does not exist. The same rule applies to 31 March plus one month, which gives 30 April. Adding days instead avoids the ambiguity entirely, which is why billing systems that must be exactly thirty days apart specify days rather than months.

أدوات ذات صلة