FormatterHQ

Random Time Generator

Generate random times of day such as 14:37 or 2:37 PM. Choose 24-hour or 12-hour format, add seconds and sort the results if you like.

Loading tool…
Ready.

How to use the Random Time Generator

  1. Choose how many times you need.
  2. Select 24-hour (14:05) or 12-hour (2:05 PM) format.
  3. Optionally include seconds and sort the times from earliest to latest.
  4. Generate and copy the list.

Random times of day

This random time generator picks an hour (0–23), a minute (0–59) and optionally a second (0–59), each uniformly at random, and formats the result as a clock time. Every minute of the day has the same chance of appearing, so over many runs the times are evenly spread from midnight to 23:59.

Random time generator formats

24-hour:               07:42   19:05   00:18
24-hour with seconds:  07:42:09   19:05:51
12-hour:               07:42 AM   07:05 PM   12:18 AM

In 12-hour format, midnight is shown as 12:xx AM and noon as 12:xx PM, following the usual convention. The 24-hour format always uses two digits for hours, which makes the values sort correctly as text.

Loading the times into a database or script

The 24-hour output with seconds, such as 14:37:09, is the format SQL TIME columns accept directly, so it is the safest choice for fixtures. 12-hour values need converting on the way in: MySQL reads them with STR_TO_DATE('2:37 PM', '%l:%i %p'), and PostgreSQL accepts '2:37 PM'::time.

For calculations, convert each time to seconds since midnight:

14:37:09 → 14 × 3600 + 37 × 60 + 9 = 52,629 s
00:00:00 → 0 s
23:59:59 → 86,399 s

Durations, averages and "is this within opening hours?" checks become simple integer comparisons. Remember that a span which crosses midnight, such as 22:00 to 02:00, needs 86,400 seconds added to the end time before you subtract.

What random times are useful for

  • Test data – fill a TIME column, a booking form or an opening-hours widget with varied values.
  • Edge cases – times around midnight and noon expose bugs in 12/24-hour conversion and in code that assumes a day starts at 1:00.
  • Spot checks and reminders – schedule random check-in times so they cannot be anticipated.
  • Games and exercises – practice reading clocks, converting between 12- and 24-hour time or calculating durations.
  • Load testing – spread simulated events across a day rather than running them all at once.

Options

  • How many – up to 10,000 times per run.
  • Format – 24-hour or 12-hour with AM/PM.
  • Seconds – add a random seconds component for timestamps that need it.
  • Sort – put the times in order. In 24-hour format this is chronological order.

12-hour vs 24-hour time

The 24-hour clock is standard in most of the world and in computing (ISO 8601, databases, logs), while the 12-hour clock with AM and PM is common in the United States and a few other countries. Testing both formats catches the classic bugs: 12:30 AM converting to 12:30 instead of 00:30, or 12 PM being treated as midnight.

Limitations

The times are plain clock times with no date or time zone attached, so daylight-saving transitions are not considered. If you need full timestamps, the random date generator can produce date-time and ISO 8601 values in UTC. To add or subtract durations from a time, use the date and time calculator.

All values are generated with a secure random source in your browser and are not stored.

Frequently asked questions

Does the generator include midnight and noon?
Yes. Every minute from 00:00 to 23:59 can appear. In 12-hour format these are shown as 12:00 AM and 12:00 PM.
Why does sorting look wrong in 12-hour format?
Sorting compares the text, so 01:15 PM can appear before 11:30 AM. Use the 24-hour format when you need chronological order, then convert if necessary.
Can I restrict times to working hours?
Not directly. Generate a larger batch and keep the values in your range, or generate hours with the random number generator (for example 9 to 17) and minutes separately.
Are the times tied to a time zone?
No. They are plain times of day without a date or zone, so they are not affected by daylight saving time.

Last updated September 26, 2026

Related tools

Random TSV Generator Generate realistic fake TSV test data — names, emails, addresses, dates and more — with custom fields. Random Username Generator Generate random usernames and gamertags from word combinations or names, with optional numbers. Random Word Generator Generate random English words — nouns, verbs, adjectives or adverbs — for games, writing prompts and naming. Random XML Generator Generate realistic fake XML test data — names, emails, addresses, dates and more — with custom fields. ULID Generator Generate sortable ULIDs (Universally Unique Lexicographically Sortable Identifiers) with monotonic ordering, in bulk, using secure randomness. UUID Generator Generate random UUID v4 or time-ordered UUID v7 identifiers in bulk, with case, hyphen and brace options. Lorem Ipsum Generator Generate lorem ipsum placeholder text by paragraphs, sentences or words, optionally wrapped in HTML <p> tags. Memorable Password Generator Generate easy-to-remember passphrases from random English words, with separators, numbers and symbols. Nano ID Generator Generate secure, URL-friendly Nano IDs with custom length and alphabet, plus a collision-probability estimate. MongoDB ObjectId Generator Generate valid 12-byte MongoDB ObjectIds for the current time or any date, as hex, ObjectId() or Extended JSON. Password Generator Generate strong random passwords with custom length and character sets, using a cryptographically secure source. Random Alphanumeric Generator Generate letters-and-digits codes for vouchers, reference IDs and usernames in mixed, upper or lower case.