1. All tools
  2. Time Tools
  3. Truncate Clock Time

Truncate Clock Time

Truncate clock time to remove seconds or minutes. Round time to the nearest hour, minute, or custom interval.

Truncate Clock Time Examples

Click to try!

Truncate Seconds

In this example, we get rid of the seconds part from several timer values. We select the "Truncate Only Seconds" mode and get a list of timer values consisting only of hours and minutes in format "hh:mm" (the ":ss" part is removed).

Truncation Side

Truncate Only Seconds

Drop the seconds component from each clock time.

Truncate Minutes and Seconds

Drop both – the minutes and seconds components from each clock time.

Print Dropped Components

Zero-print Truncated Parts

Display the dropped parts as zero values "00".

Time Padding

Use Zero Padding

Make all time components always be two digits wide.

Truncate Minutes and Seconds

This example truncates five clock times to an hour. It drops the minutes and seconds parts and only outputs the hours with zero padding.

Truncation Side

Truncate Only Seconds

Drop the seconds component from each clock time.

Truncate Minutes and Seconds

Drop both – the minutes and seconds components from each clock time.

Print Dropped Components

Zero-print Truncated Parts

Display the dropped parts as zero values "00".

Time Padding

Use Zero Padding

Make all time components always be two digits wide.

Set Seconds to Zero

In this example, we set the seconds part of each time to zero by first truncating the time to minutes and then appending a zero at the end in place of the truncated seconds. To do this, we switch on the seconds-truncation mode and activate the option to print-zero-time-parts. We also turn off the padding option and get the output time in format "h:m:s", where the seconds are always zero so the final format is "h:m:0".

Truncation Side

Truncate Only Seconds

Drop the seconds component from each clock time.

Truncate Minutes and Seconds

Drop both – the minutes and seconds components from each clock time.

Print Dropped Components

Zero-print Truncated Parts

Display the dropped parts as zero values "00".

Time Padding

Use Zero Padding

Make all time components always be two digits wide.

Related tools