Programming · free software · the open webSubscribe via RSS

How Can a Reader Find a Trip Across Midnight?

From the earlier reference collection. Read the current software blog.

Search for an overnight journey using its service date, then account for arrival times that fall on the next calendar day.

Begin with the service date

An overnight transit trip can start late on one date and finish after midnight. The service date is the schedule day that activates the trip; it may differ from the calendar date shown at the destination. When searching, begin with the date the trip belongs to in the timetable’s convention.

For instance, a trip listed as departing at 23:40 and arriving at 25:10 on Friday’s service day departs Friday night and arrives Saturday at 1:10 a.m. Searching only Saturday’s service date may not show that trip, even though the arrival occurs Saturday.

Read extended times as next-day positions

If a timetable uses hour values above 24, subtract 24 hours to get the next-day clock time while retaining the date change. A value of 25:10 becomes 1:10 a.m. on the following calendar date. A value of 24:35 becomes 12:35 a.m. the next day.

Some displays use ordinary clock times instead. In that case, look for a date label, an overnight marker, or a note explaining which service day the entries belong to. Do not assume that a trip listed near midnight is grouped by arrival date.

Follow the same trip through the stop list

Check the route, direction, and sequence of stops so the departure and arrival are part of the same trip. For example, a 23:40 departure at the terminal followed by a 00:20 intermediate stop and a 1:10 final arrival forms a coherent overnight sequence if the tool displays calendar clock times. The same sequence may be represented as 23:40, 24:20, and 25:10 in an extended-time view.

GTFS schedule data can express service-day times beyond 24:00, so retaining the service date is important when interpreting such records. [GTFS schedule reference](https://gtfs.org/documentation/schedule/reference/)

Try both date views when needed

If a search by Saturday does not find the trip, check Friday’s service date and inspect departures late in the evening. Then confirm the arrival’s calendar date. For frequent or multi-route journeys, filter by route and stop to reduce ambiguity.

The key is to keep two dates straight: the service date that determines whether the trip runs, and the calendar date on which a particular stop time occurs. Once those are separated, midnight becomes a boundary to interpret rather than a reason the trip disappears.

References

  1. GTFS Schedule Reference

Suggest a correction · All posts