Skip to content

Random Date Generator

Generate uniformly sampled calendar dates from an inclusive range without daylight-saving drift.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Choose a valid start date and end date; both endpoints are eligible for selection.
  2. 2.Enter a count from 1 to 1,000 and decide whether the same date may appear more than once.
  3. 3.Generate the dates, verify the displayed range and count, and copy or record the values you need.

About Random Date Generator

Random Date Generator draws calendar dates from a start and end date entirely in your browser. Both endpoints are included, so a range from 2024-02-28 through 2024-03-01 can return February 28, leap day, or March 1. Choose how many results you need and whether repeated dates are allowed, then generate a list in stable YYYY-MM-DD form. No date range or generated list is uploaded to Lizely. The tool supports civil dates from 0001-01-01 through 9999-12-31 and reports invalid input instead of silently repairing it.

The generator treats each date as a UTC calendar-day ordinal, not as a local midnight plus a fixed number of hours. A strict YYYY-MM-DD value is validated by setting its year, month, and day on a UTC Date object and reading the components back. Its UTC millisecond value is divided by exactly 86,400,000 to obtain the whole-day position relative to 1970-01-01. Sampling operates on those integer day positions, and the selected positions are formatted back with UTC getters. This avoids the common daylight-saving bug in which adding 24 local hours lands at 23:00 or 01:00, skips a displayed date, or repeats one near a clock transition.

Calendar validation follows the Gregorian behavior implemented by ECMAScript Date. Years divisible by four are normally leap years; century years are common unless divisible by 400. Thus 2000-02-29 and 2024-02-29 are valid, while 1900-02-29 and 2023-02-29 are rejected. Month and day overflow is also rejected: an entry such as 2025-04-31 cannot roll silently into May. The implementation uses setUTCFullYear rather than Date.UTC's legacy two-digit-year interpretation, so supported years 0001 through 0099 remain their literal years instead of being shifted into the twentieth century.

Randomness comes from the browser Web Crypto getRandomValues API through unsigned 32-bit words. Mapping a random word to a date with raw modulo can give some dates one extra possible source value when the range size does not divide 2^32. This tool removes that modulo bias with rejection sampling: it accepts only the largest leading interval whose size is an exact multiple of the number of available dates, then applies modulo. Each accepted ordinal therefore has the same number of underlying 32-bit values. A bounded safety guard reports a failed random source if it repeatedly returns values in the rejected tail. The tool does not use Math.random().

When duplicates are allowed, every requested draw independently samples the full inclusive range, so the same date may appear more than once. When duplicates are disabled, the generator performs a sparse partial Fisher-Yates selection without replacement. Every eligible date remains uniformly selectable at each step, previously selected positions are removed, and memory grows with the requested count rather than with a multi-million-day range. Unique mode rejects a count larger than the number of dates available. It never responds by returning fewer dates than requested or by quietly enabling duplicates.

The result limit is 1,000 dates per generation. A blank count, fraction, zero, negative value, or value above 1,000 produces a clear error stating the allowed range and that nothing was truncated. The start date must not be after the end date. A one-day range is valid and always returns that date; repeated results from that range require duplicate mode. Editing either endpoint, changing the count, or toggling duplicate mode clears the old list and any prior error, so a result generated with earlier settings cannot remain on screen as if it matched the current controls.

Use generated dates for test fixtures, writing prompts, sample schedules, randomized exercises, demonstrations, or other non-authoritative data. The output is not a prediction, appointment service, legal deadline calculator, business-day calendar, holiday calendar, timezone converter, or timestamp generator. Dates contain no time of day or timezone offset beyond the internal UTC ordinal method. The list does not exclude weekends, public holidays, historical calendar transitions, unavailable booking days, or organization-specific blackout dates. Check those constraints separately before using a date in a real process.

For reproducible software tests, store the resulting dates or use your own seeded test generator; Web Crypto is intentionally not seedable through this interface. For fair drawings, remember that equal probability does not prove that a particular run looks evenly spaced, and duplicate mode can legitimately repeat values. If selection has financial, legal, contest, security, or audit consequences, use a documented procedure with independent oversight and retained evidence. This browser tool provides careful unbiased sampling for ordinary utility work, not a certified random-draw service.

Methodology & sources

Strict YYYY-MM-DD inputs from years 0001-9999 are converted with UTC Date components to integer ordinals measured in 86,400,000-millisecond days. An inclusive ordinal range is sampled from Web Crypto Uint32 values using rejection sampling before modulo reduction. Duplicate mode draws independently; unique mode uses a sparse partial Fisher-Yates selection without replacement. Selected ordinals are formatted with UTC getters.

Frequently asked questions

Can the start and end dates be generated?
Yes. The range is inclusive, so both the start date and end date have the same selection opportunity as every date between them.
Can daylight-saving time skip or repeat a date?
No. The generator samples integer UTC day ordinals and formats with UTC components instead of adding hours at local midnight.
How are leap days validated?
Strict UTC component validation follows Gregorian leap-year behavior: 2000 and 2024 have February 29, while 1900 and 2023 do not.
What happens when duplicate dates are disabled?
Dates are sampled uniformly without replacement. If the requested count exceeds the number of days in the inclusive range, the tool reports an error instead of shortening the list.
Is Math.random used?
No. The tool uses browser Web Crypto unsigned words and rejection sampling to avoid modulo bias when mapping words to day positions.

Generators guides

View all