Skip to content

Random Date Generator

Updated:

Pick one or up to 1000 random dates between any two dates, with weekday/weekend filters, excluded dates, optional random times and CSV export. Everything runs locally with cryptographically secure randomness.

Generate Random Dates Between Any Two Dates

Input Fields
Date range
First possible day (inclusive).
Last possible day (inclusive).
Generation options
n
How many dates to draw (1–1000).
Output
If enabled, the result will update automatically when you change any value.

Random Date Formula

Formula
\[ d = d_1 + \lfloor r \times N \rfloor, \qquad r \sim U(0, 1), \qquad N = \left\lfloor \frac{t_2 - t_1}{86\,400\,000} \right\rfloor + 1 \]

Where:

  • \(d_1\) — start date, the first eligible day of the range (inclusive)
  • \(t_1\), \(t_2\) — UTC timestamps, in milliseconds, of the start and end dates
  • \(N\) — number of eligible days left after the day filter and the exclusion list are applied
  • \(r\) — random number drawn uniformly from \([0, 1)\)
  • \(d\) — the generated date, expressed as a day offset from the start date

The formula turns the date range into a pool of \(N\) equally likely days, then scales a uniform random number to a day offset inside that pool. When "Include time" is ticked, a second uniform draw picks one of the 86,400 seconds of the chosen day.

Random Date – Calculation Example

Example: the defaults are kept — Start date 2026-01-01, End date 2026-12-31 — with the exclusion list cleared, and a single date with a random time is drawn. The generator produces \(r = 0.42170\).

\[ N = \left\lfloor \frac{t_2 - t_1}{86\,400\,000} \right\rfloor + 1 = 365 \ \text{days} \]

\[ k = \lfloor 0.42170 \times 365 \rfloor = 153, \qquad d = 2026\text{-}01\text{-}01 + 153 \ \text{days} = 2026\text{-}06\text{-}03 \]

Result: 2026-06-03T09:26:39 — a second uniform draw of 33,999 seconds past midnight adds the time 09:26:39 to the date.

How to use the calculator

  1. Set the Start date and End date — both bounds are inclusive, and the start must not be after the end.
  2. Enter the Count of dates to draw (1–1000).
  3. Choose a Day filter: allow all days, weekdays only (Mon–Fri) or weekends only (Sat–Sun).
  4. List any Dates to exclude as YYYY-MM-DD, one per line or separated by semicolons — holidays, for example. Those days are removed from the pool before drawing.
  5. Tick Include time to add a uniformly random hh:mm:ss to every date, and Unique dates only if no day may appear twice.
  6. Pick the Sort output order and the output Format (ISO, US, EU, long, Unix timestamp, or a Custom pattern — the pattern field appears only when the custom option is selected).
  7. The results appear immediately; use the copy button or download them as CSV. Note that any change to an input triggers a brand-new draw, so save a set you like as CSV.

What is a random date generator?

A random date generator selects dates from a given range so that every eligible day has exactly the same chance of being picked — a uniform distribution. Instead of vaguely "random" behaviour, the generator compresses the whole range into a pool of \(N\) days and draws a day offset from it, so no date is favoured and short ranges get no artificial edge.

The quality of the draw depends on the source of randomness. This calculator uses crypto.getRandomValues, the cryptographically secure random generator built into modern browsers, combined with rejection sampling to eliminate the modulo bias a naive remainder operation would introduce. Statistically, this is the same standard used for secure tokens in tools like our Password Generator and UUID Generator.

Random dates are useful wherever you need unpredictable but well-distributed calendar values: generating test data for software, scheduling audits or spot checks on random days, picking giveaway or lottery dates fairly, running Monte Carlo simulations, or brainstorming deadlines. The day filter and exclusion list make it easy to model realistic scenarios — for instance, drawing random business days while skipping public holidays.

Two sampling modes are available. With Unique dates only on, days are sampled without replacement using a partial Fisher–Yates shuffle, so every combination of the requested size is equally likely and no day repeats. With it off, each draw is independent and duplicates are possible — the behaviour you want when each event (say, a daily prize draw) happens independently of the others.

Tokens for the custom pattern

When Format is set to "Custom pattern", the following tokens apply; every other character is copied literally to the output.

Token Meaning Example
yyyy / yy 4-digit / 2-digit year 2026 / 26
MMMM / MMM / MM / M Full / short / zero-padded / bare month October / Oct / 10 / 10
dd / d Zero-padded / bare day of month 03 / 3
EEEE / EEE Full / short weekday name Thursday / Thu
HH / H Hour, 24-hour clock 09 / 9
mm / m Minute 26 / 26
ss / s Second 39 / 39

Be careful not to confuse MM (month) with mm (minutes). Add HH:mm:ss to the pattern to display the random time.

Assumptions, limitations and practical tips

  • The page redraws on every change. Because the calculator recalculates whenever an input changes, each edit produces a new random set — that is expected for a generator, not a bug. Use the CSV download to keep results you want to reuse.
  • Everything is UTC. Dates are handled as UTC calendar days, so your local timezone can never shift a result by a day. Unix timestamps count seconds since 1970-01-01 00:00:00 UTC, and can be checked with our Unix Timestamp Converter.
  • Range limit. Ranges longer than 200,000 days (roughly 548 years) are rejected. For very large counts, split the work into several draws.
  • Unique mode needs enough days. If you request more unique dates than the pool contains after filtering and exclusions, the calculator tells you how many eligible days exist — lower the count, widen the range, or switch off unique mode.
  • Exclusions must match the format. Enter excluded dates as YYYY-MM-DD (or YYYY/MM/DD); anything else is ignored and reported in the summary. Dates outside the range are also ignored, since they were never eligible anyway.
  • Filters never distort the distribution. Weekday and weekend filters remove days from the pool before the draw, so the remaining days stay uniform — they are not "reshuffled probabilities".

Frequently Asked Questions

How do I pick a random date by hand, without a calculator?

First count the days in your range: with an inclusive start and end, \(N = \lfloor (t_2 - t_1)/86400000 \rfloor + 1\). Then pick a random integer \(k\) from 0 to \(N-1\) — dice, shuffled cards or a random number table work — and add \(k\) days to the start date. If you also need a random time, roll a number from 0 to 86,399 and convert it to hh:mm:ss.

Are the results truly random, or can repeats reveal a bug?

The draw uses crypto.getRandomValues, a cryptographically secure source, so the results are genuinely uniform. With "Unique dates only" switched off, every draw is independent, and duplicates in a large set are normal — the well-known birthday effect means about 23 people share a birthday half the time. If you need every date to be distinct, tick "Unique dates only" to sample without replacement.

Can I generate random business days while skipping public holidays?

Yes. Set the day filter to "Weekdays only (Mon–Fri)", then paste your holidays into "Dates to exclude" as YYYY-MM-DD, one per line. Those days are removed from the pool before drawing, so the remaining business days stay perfectly uniform. Only weekdays inside the range count; holiday entries outside the range are ignored automatically.

Why do my results sometimes differ by a day from another tool?

This generator works in UTC, so a date always means that exact calendar day regardless of your local timezone. Tools that use local time can shift results near midnight or across timezone boundaries. Everything shown — including Unix timestamps, which count seconds since 1970-01-01 00:00:00 UTC — is timezone-proof and reproducible when compared with a UTC-based converter.

I got an error that there are not enough eligible days. What does it mean?

With "Unique dates only" on, each day can be drawn at most once, so the count cannot exceed the pool of eligible days that remain after the weekday filter and exclusions. For example, a 30-day range with weekends excluded offers only about 21 weekdays. Fix it by lowering the count, widening the range, clearing some exclusions, or switching unique mode off.

Why is my custom pattern showing minutes instead of the month?

The tokens are case-sensitive: uppercase MM means month and lowercase mm means minutes — the same applies to HH (hour) versus other letters. So "dd/mm/yyyy" prints day, minute, year, not day/month/year. For a European date use "dd/MM/yyyy", and add " HH:mm:ss" only if you also ticked "Include time".

What is the largest range and count I can use?

Ranges up to 200,000 days — roughly 548 years — are accepted, and a single draw can produce up to 1,000 dates. For longer historical ranges, split the work into several draws and combine the CSV files. Note the exclusions field also requires four-digit years, so very old or far-future dates should still be entered in full YYYY-MM-DD form.

Leave a Reply

Your email address will not be published. Required fields are marked *