Skip to content
Astera Technology

Calculate a service window that crosses midnight

Use day-qualified timestamps to avoid a negative or shortened overnight duration.

Attach the day to each time

Fictional overnight coverage is day 1 22:00 to day 2 02:00, start included/end excluded. An observed interruption runs day 1 23:50 to day 2 00:20. It is entirely within coverage; the task measures minutes, not an annual uptime claim.

Overnight timestamps
IntervalBefore midnightAfter midnight
Coverage120 min120 min
Interruption10 min20 min
End boundaryDay 202:00 excluded
Download editable CSV ↓

Measure on one continuous line

  1. Order day-qualified timestamps
  2. Split once at midnight
  3. Sum the segment lengths

A time without a day is insufficient to decide an overnight order.

How long is the interruption and uninterrupted covered time?

Show the worked answer

30 interruption minutes and 210 uninterrupted minutes:10+20=30;240−30=210. An event at 02:00 is outside this window.

Check the closing boundary

Filled decision checks
CaseDecisionReason
23:50 day 1→00:20 day 230 minDates retain forward order
Event at day 2 02:00OutsideEnd is excluded
Download editable CSV ↓

Keep both dates in the incident extract. A display showing only clock time cannot support this duration on its own.

Related resources