SECTION 23 / 28

Use journey days when subtracting times

1 min read
Day 1 20:00 to Day 2 03:30 lasts 7 h 30 min. A stop from 23:59 to next-day 00:04 lasts five minutes.
Day 1 20:00 to Day 2 03:30 lasts 7 h 30 min. A stop from 23:59 to next-day 00:04 lasts five minutes.
REAL COURSE DATA · SORT, GROUP AND VERIFY

Include journey days when subtracting times

Follow the selected procedure. Change a field, tie rule or weekday and explain why the result changes.

Ready

CURRENT RECORD / VALUE

Ready to begin

No records have been processed. Start with Next step.

What we remember

Processed
0

Predict the next change. Keep track of which list level, field and position convention the procedure uses.

ElapsedMinute(day, time) = (day-1)*1440 + 60*hour(time) + minute(time)
JourneyMinutes = ElapsedMinute(arrivalDay, arrivalTime)
                 - ElapsedMinute(departureDay, departureTime)

Clock text alone cannot distinguish the next morning from the previous morning. On 02201, Kolkata Day 1 20:00 to Bhubaneswar Day 2 03:30 is 450 minutes, or 7 h 30 min. Return 02202 runs 20:15 to next-day 04:15: 480 minutes.

The 12270 Bhopal row arrives 23:59 and leaves 00:04. Its printed Day 2 aligns with departure after midnight; the arrival belongs to Day 1 in the route chronology. The lab stores separate arrivalDay and departureDay values to make the five-minute dwell explicit instead of producing a negative duration.

This resolves a representational ambiguity in the supplied format; it is not a rule that every printed row day always means arrival day. Check the full sequence and cross-view weekdays. Do not subtract missing endpoint fields as if they were times.

Try it yourself

Why is 03:30 − 20:00 a bad duration calculation here?

Show explained answer

It ignores the day change. Convert both date-relative times to a common minute index first.

Try it yourself

What is the 12270 Bhopal dwell across midnight?

Show explained answer

5 minutes: 23:59 on one day to 00:04 the next.

Try it yourself

Can a row’s one printed day safely be copied to both times in every case?

Show explained answer

No. A midnight-crossing stop may need different arrival and departure day indices.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑