Date and Time Formulas in Mathematics

Date and time formulas convert units, calculate elapsed time, compare calendar dates, and handle leap-year edge cases. The arithmetic is simple when the unit is fixed. Calendar work is harder because months have different lengths, leap years have exceptions, and local clock changes can make a civil day shorter or longer than 24 hours.

Use seconds for pure duration, calendar arithmetic for dates, and a timezone-aware date library for real timestamps. Do not treat a month as 30 days or a year as 365 days unless the problem explicitly defines that approximation.

Core time conversion formulas

For a fixed duration, choose one base unit and convert every term before adding or subtracting.

UnitSecondsMinutesHoursDays
1 minute6011/601/1,440
1 hour3,6006011/24
1 day86,4001,440241
1 week604,80010,0801687
  • $$\text{seconds}=60\times\text{minutes}=3{,}600\times\text{hours}=86{,}400\times\text{days}$$
  • $$\text{hours}=\frac{\text{seconds}}{3{,}600}=\frac{\text{minutes}}{60}=24\times\text{days}$$
  • $$\text{days}=\frac{\text{seconds}}{86{,}400}=\frac{\text{hours}}{24}=7\times\text{weeks}$$

Elapsed time on the same day

Convert both clock times to minutes or seconds after midnight, subtract the start from the end, then convert the result back.

ExampleCalculationResult
09:35 to 14:20(14 x 60 + 20) – (9 x 60 + 35)285 minutes = 4 h 45 min
12:08:45 to 13:10:0547,405 – 43,7253,680 seconds = 1 h 1 min 20 s

Elapsed time across midnight

When the end time is on the next day, add one full day before subtracting.

  • $$\text{elapsed seconds}=(86{,}400-\text{start seconds})+\text{end seconds}$$
  • 23:50 to 00:25 next day: 10 minutes to midnight + 25 minutes = 35 minutes = 2,100 seconds.

The Gregorian leap-year rule

A year is a leap year when it is divisible by 4, except century years must also be divisible by 400. The shortcut ‘every four years’ fails at 1900 and 2100.

  1. If the year is not divisible by 4, it is not a leap year.
  2. If it is divisible by 4 but not by 100, it is a leap year.
  3. If it is divisible by 100, it is a leap year only when divisible by 400.
YearDivisible by 4Century yearDivisible by 400Leap year?
1900YesYesNoNo
2000YesYesYesYes
2024YesNoNot neededYes
2026NoNoNot neededNo
2100YesYesNoNo

Month and year totals

Month totals depend on the named month and year. A calendar year has 365 days normally and 366 days in a leap year.

PeriodDaysHoursMinutesSeconds
February, common year2867240,3202,419,200
February, leap year2969641,7602,505,600
30-day month3072043,2002,592,000
31-day month3174444,6402,678,400
365-day year3658,760525,60031,536,000
366-day year3668,784527,04031,622,400

Calendar-date differences

Count actual dates, not average month lengths. Decide whether the start or end date is included before calculating.

Date rangeConventionCount
Feb 27 to Mar 3, 2026Exclusive of the start date4 days
Feb 27 to Mar 3, 2026Inclusive of both dates5 calendar dates
Feb 27 to Mar 3, 2024Exclusive of the start date5 days because Feb 29 exists

Check your calculation

The verifier below uses the browser’s local date and time values. It is useful for checking arithmetic, but legal, payroll, travel, and server timestamps should use an explicit timezone and a tested date library.

Check elapsed time and leap years

Choose a start and end value.

Common mistakes

  • Treating every month as 30 days. Use the actual month and year.
  • Calling every fourth year a leap year. Apply the century exception.
  • Mixing inclusive and exclusive counting. State the convention before solving.
  • Assuming every local day is exactly 24 hours. Daylight-saving transitions can change civil-clock duration.
  • Subtracting formatted clock text. Convert to one numeric unit first.

Frequently asked questions

These answers cover the conversion and calendar edge cases that cause most errors.

How do I convert hours and minutes to decimal hours?

Divide the minutes by 60 and add the hours. For example, 4 hours 45 minutes is $4+45/60=4.75$ hours.

How do I convert decimal hours back to hours and minutes?

Keep the whole-number hours, multiply the decimal part by 60, and round only at the precision required. For example, 3.4 hours is 3 hours and $0.4\times60=24$ minutes.

Why can two timestamps be 23 or 25 hours apart on adjacent dates?

A daylight-saving transition can move the local clock forward or backward. Use timezone-aware timestamps when the real elapsed duration matters.