Clock Time Truncator
Truncate clock time values to a specific precision - hours, minutes, seconds, or milliseconds. Supports multiple time formats.
About
Time truncation removes lower-order components from a time value without rounding. Given t = 14:37:52.841, truncating to minutes yields 14:37:00.000, not 14:38:00.000. This distinction matters in billing systems, log correlation, and time-series data alignment where rounding introduces forward bias. Payroll systems truncating to the quarter-hour can shift thousands of dollars annually per employee depending on whether they round or truncate. Database timestamps truncated inconsistently across services cause join failures and phantom duplicates in event pipelines.
This tool parses time in multiple notations - HH:MM:SS.mmm, 12-hour with AM/PM, decimal hours, and bare HH:MM - then applies floor division at the chosen unit boundary. The operation is idempotent: truncating an already-truncated value returns the same value. Note: this tool operates on wall-clock time values, not durations spanning multiple days. Inputs exceeding 23:59:59.999 are clamped.
Formulas
The truncation operation converts a time value t into total milliseconds T, then applies floor division by the unit size U in milliseconds:
Where T = total time in milliseconds, computed as:
And U is the unit boundary in milliseconds:
The discarded portion is: D = T − Ttrunc. The operation is idempotent: trunc(trunc(t)) = trunc(t).
Reference Data
| Input Time | Truncate To | Result | Discarded |
|---|---|---|---|
| 14:37:52.841 | Hour | 14:00:00.000 | 37m 52.841s |
| 14:37:52.841 | Minute | 14:37:00.000 | 52.841s |
| 14:37:52.841 | Second | 14:37:52.000 | 0.841s |
| 14:37:52.841 | 100ms | 14:37:52.800 | 41ms |
| 14:37:52.841 | 10ms | 14:37:52.840 | 1ms |
| 09:59:59.999 | Hour | 09:00:00.000 | 59m 59.999s |
| 23:59:59.999 | Minute | 23:59:00.000 | 59.999s |
| 00:00:00.001 | Second | 00:00:00.000 | 1ms |
| 12:00:00.000 | Hour | 12:00:00.000 | 0ms |
| 3:45 PM | Minute | 15:45:00.000 | 0s |
| 11:30 PM | Hour | 23:00:00.000 | 30m 0s |
| 7.75 (decimal hours) | Hour | 07:00:00.000 | 45m 0s |
| 0:00:00.000 | Any | 00:00:00.000 | 0ms |
| 06:14:59.995 | 10ms | 06:14:59.990 | 5ms |
| 18:29:30.500 | 100ms | 18:29:30.500 | 0ms |