Calculadora de Diferença de Datas
Calcule dias, meses e anos exatos entre duas datas.
Total de dias
Cálculo preciso de diferença de datas
Esta calculadora considera o número exato de dias em cada mês e anos bissextos para fornecer a duração precisa entre duas datas.
Calculating Time Between Dates
Overview
Calculating the difference between two dates seems trivial — but anyone who has tried to write the code knows the edge cases pile up quickly. Leap years, varying month lengths, time zones, daylight saving transitions, calendar reforms (Russia switched calendars in 1918), and ambiguous month arithmetic (Jan 31 + 1 month = Feb 28? Mar 3?) all complicate the answer. This calculator handles all standard cases for the Gregorian calendar (1582 onward), giving you a breakdown in years, months, weeks, days, hours, minutes, and seconds.
How It Works
The tool computes the raw difference using JavaScript's Date object (millisecond precision), then breaks it into hierarchical units. Years are counted as completed years (Feb 1 → Jan 31 next year = 0 years, not 1). Months use day-of-month preservation when possible. The calculator also offers business-days-only mode for project planning (excludes weekends; doesn't account for holidays unless you provide them).
When to Use This
Calculate days until a deadline, weeks until a vacation, months between life events (anniversaries, work milestones), or precise age between birth and a target date. Project managers use it for estimating timelines. Anyone tracking habits (X days streak) needs precise day counts across timezone-crossing trips. Legal contracts often specify dates 30/60/90 days from signing.
Frequently Asked Questions
Why does the result sometimes differ by one day?
Time zones. If you enter '2024-01-01' it's interpreted in your local timezone, but the system might compute against UTC. For business use, prefer UTC-explicit inputs or use the same timezone for both dates.
How are leap years handled?
Years divisible by 4 are leap (366 days) except century years not divisible by 400. 1900 was not a leap year, but 2000 was. The calculator handles this automatically.
Does it count both start and end day?
By default no — Jan 1 to Jan 2 = 1 day. Many calendars count inclusively (Jan 1 to Jan 2 = 2 days). Be aware which convention matters for your use case.
Ferramentas recomendadas
Utilitários selecionados que você pode achar úteis