Sub topic 7
Working with times of day and durations
This chapter assumes you know how Sheets stores dates as serial numbers, how number formats change only the display, and how to build dates with DATE and NOW. Here you apply those ideas to the fractional part of the number, which holds the time of day. You will also use it to measure durations such as hours worked.
A time is a fraction of a day
A date-time serial number has two parts. The whole number counts days. The fraction after the decimal point is the portion of that day that has passed.
| Time of day | Stored fraction |
|---|---|
| 00:00 (midnight) | 0 |
| 06:00 | 0.25 |
| 12:00 (noon) | 0.5 |
| 18:00 | 0.75 |
| 23:59:59 | 0.999988... |
So a cell that shows 12:00:00 and has a time format holds 0.5. A cell with the value 46354.75 is 18:00 on the day numbered 46354. Format the cell as Number to see the raw value, and as Time to see the clock reading.
Because the fraction is a share of 24 hours, every conversion uses the same set of multipliers:
| To get | Multiply a day-based difference by |
|---|---|
| Hours | 24 |
| Minutes | 1440 (24 × 60) |
| Seconds | 86400 (24 × 60 × 60) |
Building times with TIME
TIME(hour, minute, second) returns the fraction for a time of day.
=TIME(14, 30, 0)This stores about 0.604167. With a Time format it displays as 14:30:00, or 2:30:00 PM in some formats.
TIME is meant for clock times. Values above the 24-hour range wrap around the clock, so TIME(25, 0, 0) gives 1:00, not a 25-hour duration. For durations, divide instead:
=90/1440This is 90 minutes expressed as a fraction of a day. To turn a decimal number of hours into a duration, use =A2/24. The result looks wrong until you format the cell as Format > Number > Duration.
To combine a date with a time of day, add them:
=DATE(2026, 11, 28) + TIME(9, 15, 0)The result is a date-time, 2026-11-28 09:15:00.
Splitting a date-time
Two small patterns separate the whole-day part from the time part:
=INT(A2)
=MOD(A2, 1)INT(A2) drops the fraction and leaves the date. MOD(A2, 1) keeps only the fraction, which is the time of day. Format the first as a date and the second as a time.
HOUR, MINUTE and SECOND read the clock parts of a value:
=HOUR(A2)
=MINUTE(A2)
=SECOND(A2)These return the clock reading, not the total. HOUR(1.5) returns 12, because 1.5 days is a day and a half and the clock part is 12:00. If you need the total hours of a duration longer than a day, use =A2*24.
Measuring a duration
A duration is the difference between two date-times, so you subtract.
=B2 - A2The result is in days. Format the cell as Duration, or use a custom format such as [h]:mm, to see it as elapsed time. The square brackets tell Sheets to keep counting hours past 24 instead of wrapping back to zero. Without them, 26 hours displays as 2:00.
To get a plain number instead, convert the unit:
=(B2 - A2) * 24
=(B2 - A2) * 1440
=(B2 - A2) * 86400These give hours, minutes and seconds as ordinary numbers. Format those result cells as Number, because Sheets often applies a time format automatically when you subtract times.
Shifts that cross midnight
If a shift starts at 22:00 and ends at 06:00, the end time is a smaller fraction than the start. Plain subtraction gives a negative result.
=B2 - A2With only times of day in the cells, MOD fixes this by wrapping the result into the 0 to 1 range:
=MOD(B2 - A2, 1)For 22:00 to 06:00 this returns 8 hours as a fraction of a day (0.3333...). The same formula still works when the shift does not cross midnight. It does not work when the gap is 24 hours or more, because MOD would discard whole days. If your cells hold full date-times, plain subtraction is correct and you do not need MOD.
Worked example: a timesheet
Set up this layout, with a header in row 1:
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Start | End | Break (min) | Worked | Hours |
| 2 | 22:00 | 06:00 | 30 |
Enter the worked time in D2 and the decimal hours in E2:
=MOD(B2 - A2, 1) - C2/1440
=ROUND(D2 * 24, 2)D2 is 7 hours 30 minutes, shown in a Duration format. E2 is 7.5. Dividing the break minutes by 1440 turns them into a fraction of a day so they can be subtracted from a day-based value.
To total a column of durations, use =SUM(D2:D20) and format the result as Duration or [h]:mm. If you use a plain Time format, a total over 24 hours wraps and looks too small, even though the stored value is correct.
Rounding times
Times are stored as floating-point fractions, so results can carry tiny errors. A comparison such as =D2 = TIME(8, 0, 0) can return FALSE even when both cells display 8:00. Round before comparing:
=ROUND(D2 * 1440, 0)This gives whole minutes. To round a time to the nearest 15 minutes, scale to quarter-hours (there are 96 per day), round, and scale back:
=ROUND(A2 * 96, 0) / 96Converting typed text
A time typed as text, such as an imported "14:30" that is left-aligned, is not yet a number. TIMEVALUE converts it:
=TIMEVALUE("14:30")This returns about 0.604167. If the text includes a date, DATEVALUE extracts the date part and VALUE handles the combined date-time in many cases. To display a time as a text label, use TEXT:
=TEXT(A2, "hh:mm")
=TEXT(B2 - A2, "[h]:mm")TEXT returns text, so you cannot do arithmetic on its result without converting back.
Common errors
- A total looks too small. The cell uses a Time format and wraps at 24 hours. Switch to Duration or
[h]:mm. - A time difference shows as a clock time such as 8:00 AM. The cell format is wrong, not the value. Choose Duration or Number.
- A negative result for overnight work. Use
MOD(B2 - A2, 1)when the cells hold only times of day. - Hours are off by a factor of 24. You forgot to multiply by 24, or you multiplied a value that was already in hours.
- Equality tests fail on matching times. Floating-point error. Round both sides to whole minutes or seconds.
HOURreturns less than expected for long durations.HOURreturns the clock part. Use*24for total hours.
Exercise
Column A holds a start time of 21:30 and column B holds an end time of 05:45 on the next morning. Both cells contain only times of day. Write one formula that returns the hours worked as a decimal number, rounded to 2 decimal places.
Show answer
=ROUND(MOD(B2 - A2, 1) * 24, 2). MOD wraps the negative difference into a positive fraction of a day, multiplying by 24 converts it to hours, and ROUND trims floating-point noise. The result is 8.25.
Exercise
A cell contains the value 0.75. What time of day is it, and which formula converts 45 minutes into a value you can add to a time?
Show answer
0.75 is 18:00, because it is three quarters of 24 hours. Use =45/1440 (or =TIME(0, 45, 0)) to get 45 minutes as a fraction of a day, and add it to the time.