Format Code Now
/

Random Time Generator

RG-08

Type a start and an end time and press Generate to get random times of day between them. Show them as 24-hour or 12-hour AM/PM, with or without seconds and milliseconds.

Runs in your browser. Nothing is uploaded.

Range: start and end time on one line, 24-hour (empty means 00:00:00 23:59:59)

Times

How to use it

  1. Type the range as start and end in 24-hour form, such as 09:00 17:30:00. Empty means the whole day.
  2. Choose how many times, the clock style, and whether to show seconds or milliseconds.
  3. Pick an order if you want the times sorted.
  4. Press Generate and copy the list.

Input format

Write each time as hh:mm or hh:mm:ss in 24-hour form, optionally with milliseconds after a dot, such as 07:45:30.250. Separate the start and end with a space, comma or the word to. Both ends are included in the draw. The range cannot wrap past midnight, so a start of 22:00 and an end of 02:00 gives an error.

Seconds and milliseconds

Without milliseconds the times land on whole seconds. With them on, the times can fall on any millisecond in the range. Turning off Show seconds only hides the seconds in the text, so two different times can look the same when printed. If the range is shorter than a second and milliseconds are off, the page tells you no whole second fits.

A time, not a date

Results have no date and no time zone. Use them as sample start times, appointment slots or log lines for tests. For a full date, use the random birthday or date tools. Values use crypto.getRandomValues, and nothing is stored or sent.

Error messages and what to do

MessageWhat it meansFix
The start time is later than the end time. Put the earlier time first (times do not wrap past midnight).The range starts after it ends.Swap the two times.
Could not read "25:00" as a time. Use hh:mm or hh:mm:ss in 24-hour form, such as 07:45:30.A time is not valid 24-hour clock text.Use hh:mm or hh:mm:ss with hours 00 to 23.

Questions people ask

How do I generate a random time between two times?

Type the start and end, such as 09:00 17:00, choose how many times you want and press Generate. Each line is a random time inside that range.

Can it show 12-hour times with AM and PM?

Yes. Set Clock to 12-hour AM/PM. Midnight is shown as 12 AM and noon as 12 PM.

Can I get a random time with milliseconds?

Tick Include milliseconds. Times then appear like 14:03:27.482, and the draw covers every millisecond in your range.

Can the range cross midnight?

No. The start must not be later than the end. For a range such as 22:00 to 02:00, generate two sets, one for 22:00 to 23:59 and one for 00:00 to 02:00.

Can the times be sorted?

Yes. Choose Smallest first or Largest first under Order and the list is sorted by time of day. The default keeps the order they were drawn in.

Are the times evenly spread?

Yes. Each moment in the range has the same chance, drawn with rejection sampling from your browser's secure random generator.

About this tool

Picks times of day uniformly between the start and end you type, both included. Input is read as 24-hour hh:mm or hh:mm:ss, with optional .mmm milliseconds. The range does not wrap past midnight: a start later than the end gives an error. Without milliseconds, times land on whole seconds. Turning off Show seconds only hides them in the text, so two results can look the same. Times have no date or time zone. Values use crypto.getRandomValues; nothing is stored or sent.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.