Staaarter

Sort Time Intervals

Sorts a newline-separated list of "start-end" clock time ranges, such as "09:00-10:00", by ascending start time while keeping each range's start and end paired together. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-08-05
By Staaarter Team
timesorting

Overview

Introduction

A day's worth of meeting slots, shift blocks, or availability windows is rarely handed to you already sorted by when it starts.

This tool sorts a list of "start-end" time ranges ascending by their start time, keeping each pair intact.

What Is Sort Time Intervals?

A line-based sorter for time ranges: paste one "start-end" interval per line and get the list back ordered by start time.

Both the start and end of each interval are validated as real 24-hour clock times, but only the start is used to determine sort order.

How Sort Time Intervals Works

Each line is split on the hyphen between its two time values, and both the start and end are validated against the 24-hour HH:MM(:SS) pattern.

Intervals are sorted using the start time's total seconds since midnight, and the original "start-end" text is written back unchanged in the new order.

When To Use Sort Time Intervals

Use it to order a day's meeting or booking slots, shift blocks, or availability windows by when they begin.

It's a useful first pass before manually checking a schedule for overlaps or gaps.

Often used alongside Sort Clock Times and Validate a Clock Time.

Features

Advantages

  • Keeps each interval's start and end together as a unit instead of sorting the two halves independently.
  • Accepts both HH:MM and HH:MM:SS on either side of an interval.
  • Preserves the original "start-end" text formatting in the output.

Limitations

  • Sorts by start time only, it does not detect or resolve overlapping intervals.
  • Requires the exact "start-end" hyphenated format; other separators aren't recognized.

Examples

Sorting two meeting slots

Input

14:00-15:30
09:00-10:00

Output

09:00-10:00
14:00-15:30

The 09:00 slot starts earlier, so it moves to the top.

Best Practices & Notes

Best Practices

  • Use a single hyphen with no spaces between the start and end time, e.g. "09:00-10:00", not "09:00 - 10:00".
  • Run Clock Time Validator on an individual time first if you're unsure whether it's correctly formatted before building a list of intervals.

Developer Notes

Each line is matched with /^(\d{1,2}:\d{2}(?::\d{2})?)-(\d{1,2}:\d{2}(?::\d{2})?)$/ to separate the start and end, both of which are independently validated and converted to seconds-since-midnight; only the start value feeds the sort comparator, matching how a calendar view typically orders events.

Sort Time Intervals Use Cases

  • Ordering a day's meeting bookings by start time before building an agenda
  • Sorting shift blocks pulled from a scheduling spreadsheet
  • Arranging class or event time slots chronologically for a printed schedule

Common Mistakes

  • Using a space or an en dash instead of a plain hyphen between the start and end time, which fails the strict pattern match.
  • Forgetting that overnight intervals (like "23:00-01:00") sort by their start time only, so they land with other late-evening intervals, not after midnight.

Tips

  • For single time points rather than ranges, use Clock Time Sorter instead.
  • For date ranges instead of time-of-day ranges, use Date Interval Sorter.

References

Frequently Asked Questions