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.
| Unit | Seconds | Minutes | Hours | Days |
|---|---|---|---|---|
| 1 minute | 60 | 1 | 1/60 | 1/1,440 |
| 1 hour | 3,600 | 60 | 1 | 1/24 |
| 1 day | 86,400 | 1,440 | 24 | 1 |
| 1 week | 604,800 | 10,080 | 168 | 7 |
- $$\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.
| Example | Calculation | Result |
|---|---|---|
| 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:05 | 47,405 – 43,725 | 3,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.
- If the year is not divisible by 4, it is not a leap year.
- If it is divisible by 4 but not by 100, it is a leap year.
- If it is divisible by 100, it is a leap year only when divisible by 400.
| Year | Divisible by 4 | Century year | Divisible by 400 | Leap year? |
|---|---|---|---|---|
| 1900 | Yes | Yes | No | No |
| 2000 | Yes | Yes | Yes | Yes |
| 2024 | Yes | No | Not needed | Yes |
| 2026 | No | No | Not needed | No |
| 2100 | Yes | Yes | No | No |
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.
| Period | Days | Hours | Minutes | Seconds |
|---|---|---|---|---|
| February, common year | 28 | 672 | 40,320 | 2,419,200 |
| February, leap year | 29 | 696 | 41,760 | 2,505,600 |
| 30-day month | 30 | 720 | 43,200 | 2,592,000 |
| 31-day month | 31 | 744 | 44,640 | 2,678,400 |
| 365-day year | 365 | 8,760 | 525,600 | 31,536,000 |
| 366-day year | 366 | 8,784 | 527,040 | 31,622,400 |
Calendar-date differences
Count actual dates, not average month lengths. Decide whether the start or end date is included before calculating.
| Date range | Convention | Count |
|---|---|---|
| Feb 27 to Mar 3, 2026 | Exclusive of the start date | 4 days |
| Feb 27 to Mar 3, 2026 | Inclusive of both dates | 5 calendar dates |
| Feb 27 to Mar 3, 2024 | Exclusive of the start date | 5 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.