Overview
Introduction
Averaging clock times sounds like a simple arithmetic problem, but a plain mean gets badly wrong answers whenever the times straddle midnight.
This tool uses a circular mean instead, which correctly treats the 24-hour clock as a loop rather than a line, so times near midnight average the way you'd intuitively expect.
What Is Calculate Average Time?
A clock-time averaging tool built around the circular mean, the standard technique for averaging angular or cyclical quantities like compass headings, days of the week, or times of day.
It accepts any number of clock times, one per line, and returns a single averaged time.
How Calculate Average Time Works
Each time is converted to an angle on a 24-hour clock face (a full day equals 360 degrees), then to a unit vector using cosine and sine.
All the unit vectors are averaged together, and the angle of the resulting average vector is converted back into a clock time via the arctangent function.
When To Use Calculate Average Time
Use it whenever a set of clock times might straddle midnight, such as averaging bedtimes, night-shift clock-ins, or sunrise times across the year.
For calendar dates rather than times of day, use Calculate Average Date instead, since dates don't wrap around the way clock times do.
Often used alongside Calculate Average Date, Generate Custom Clock Times and Split Time into Intervals.
Features
Advantages
- Correctly handles times that straddle midnight, unlike a plain arithmetic mean of seconds-since-midnight.
- Works with any number of input times, from two up to a long list.
- Accepts both "HH:MM" and "HH:MM:SS" formats without needing to normalize input beforehand.
Limitations
- Times that are perfectly evenly distributed around the clock have no well-defined circular mean, and the tool reports an error rather than guessing.
- Only works with 24-hour clock times; it doesn't account for time zones or AM/PM-formatted input.
Examples
Best Practices & Notes
Best Practices
- Enter all times using the 24-hour clock (23:00 rather than 11 PM) to avoid ambiguity.
- If the tool reports the times cancel out, check whether they're roughly opposite each other on the clock face, that's the one case with no single meaningful average.
Developer Notes
Each time is converted to seconds since midnight, then to an angle in radians via `(seconds / 86400) * 2 * Math.PI`. The cosine and sine of every angle are averaged separately, and `Math.atan2` recovers the mean angle from those two averaged components; this two-step averaging is what makes the mean "circular" rather than linear. If the averaged (cos, sin) vector's magnitude is near zero, the input times cancel out and there is no meaningful single average, so the tool returns an error instead of an arbitrary angle.
Calculate Average Time Use Cases
- Finding the average bedtime or wake-up time from a week of sleep-tracking data that spans midnight
- Averaging night-shift clock-in times that cluster around midnight
- Computing an average sunrise or sunset time across a range of dates
Common Mistakes
- Expecting the same result as a plain arithmetic mean, which gives the wrong answer whenever the times straddle midnight.
- Entering 12-hour AM/PM times directly, they need to be converted to 24-hour format first (11 PM becomes 23:00).
Tips
- If you only have two times, the circular mean will always land on one of the two arcs between them, the shorter arc when they're less than 12 hours apart.
- Use Time Interval Splitter afterward if you need to divide the time around the computed average into equal chunks.