Random Date Generator
Last updated: 19 August 2026
Reviewed by Gavin ยท Research and drafting assisted by AI
Random Date Generator
Need to pick a random day on the calendar? Whether you are running a lottery draw, scheduling a randomised experiment, breaking a classroom silence by calling on a student, or just settling "when should we meet next?", a random date generator saves the trouble of doing it by hand. This free online tool picks one or many dates within a range you choose, lets you exclude weekends, specific weekdays, or particular days that do not work for you, and shows the result in three formats at once: ISO 8601 (2024-08-15), RFC 2822 (Thu, 15 Aug 2024), and Unix timestamp (seconds since the Unix epoch in UTC). You can copy any of those formats with a single click.
Random selection lies at the heart of many everyday decisions. Lottery draws need an unbiased winner. Survey designers want a representative sample of dates so they do not accidentally favour a particular weekday. Game masters running a campaign need a fair way to assign random encounter dates. Teachers use random call tools to ensure every student gets a turn. And for personal life, picking a random Friday for date night, scheduling a "mystery holiday", or just having fun, the same algorithm applies.
How to Use the Random Date Generator
- Pick your start date. The default is 1 January 1970, the start of the Unix epoch. Most browsers will let you click the date input to open a calendar picker.
- Pick your end date. The default is today. If you only need dates in the past, set the end to a date before today. If you need future dates, today remains the upper bound by default, but you can change both endpoints freely.
- Choose your exclusions. You have three independent toggles:
- Exclude weekends, removes every Saturday and Sunday from the pool.
- Exclude specific weekdays, click Mon, Tue, Wed, Thu, Fri, Sat, or Sun to remove one or more weekdays from the pool. Multi-select works.
- Exclude specific dates, pick any individual date and add it. Useful for holidays, anniversaries, or days you already know are taken.
- Choose the bulk count. Default is 1. Type any number from 1 to 100 to generate that many dates in a single click.
- Click Generate. The tool will return one result per requested date. Each result shows ISO 8601, RFC 2822, and Unix timestamp with its own copy button.
The footer under the Generate button tells you how many days in your range are still eligible after exclusions, so if you set up rules that leave zero days, you will see it before you wonder why nothing came back.
The Algorithm
The generator uses a uniform random pick over the range, then applies a rejection-sampling loop to honour the exclusions. Concretely:
- Convert both endpoints to UTC midnight using
Date.UTC(startYear, startMonth, startDay)and the same for the end date. Working in UTC keeps the math timezone-stable regardless of where the user is. - Compute the span in days:
span = floor((endMs โ startMs) / 86,400,000) + 1. Adding one makes the end date inclusive. - Draw a uniform random integer
kin[0, span]using a cryptographically secure source:crypto.getRandomValues(new Uint32Array(1))[0] % span. If the browser does not expose the Web Crypto API, the generator falls back toMath.random, which is still uniform-enough for non-security-sensitive picks. - Compute the candidate date:
candidate = startMs + k ร 86,400,000. - Reject if any of the exclusion rules apply:
- Weekend rule:
getUTCDay()returns0for Sunday or6for Saturday. - Weekday rule: the candidate's
getUTCDay()is in the user-supplied list of excluded weekdays. - Date rule: the candidate's ISO representation is in the user-supplied list of excluded dates.
- Weekend rule:
- Repeat from step 3 until a candidate passes, with a hard ceiling of 1000 attempts. If the rejection rate is so high that 1000 attempts cannot find an acceptable date (a vanishingly rare edge case where the eligible pool is tiny), the algorithm falls back to a linear scan that always succeeds whenever at least one day remains eligible.
- For bulk mode (N > 1), the loop continues until N unique dates have been collected.
Why Rejection Sampling?
Rejection sampling is the simplest correct approach when the set of "valid" days is irregular (some weekdays excluded, specific dates excluded, weekends excluded). The alternative, listing every eligible day and then picking an index, works fine but requires an O(N) scan to build the eligible list every time the user toggles an exclusion. Rejection sampling lets the user toggle rules instantly and only pays a cost when Generate is pressed.
Why UTC?
JavaScript's Date object stores time as milliseconds since the Unix epoch in UTC, but its getDay(), getDate(), and getMonth() accessors operate in the local timezone. That mismatch is the most common source of date bugs in JavaScript: a date created at midnight in one timezone can read as "23:00 the day before" in another. We deliberately use the getUTC* family of accessors, which always operate in UTC, so a date generated in Tokyo is the same date when opened in Berlin.
Worked Examples
Example 1, Random business day in August 2024. Start date: 2024-08-01. End date: 2024-08-31. Exclude weekends: on. Bulk: 1. There are 31 days in August 2024; 22 are weekdays (Mon-Fri). Each weekday has an equal 1/22 chance. A typical result: 2024-08-21, ISO 8601 = 2024-08-21, RFC 2822 = Wed, 21 Aug 2024 00:00:00 +0000, Unix timestamp = 1,724,198,400. Copy any of the three formats into a calendar invite.
Example 2, Batch of 10 random dates for a 30-day campaign. Start date: 2024-09-01. End date: 2024-09-30. No exclusions. Bulk: 10. The generator returns 10 unique dates in roughly chronological order (the algorithm itself does not sort, but the rejection-sampling loop tends to produce non-overlapping days; the UI can be re-sorted client-side if you want them strictly increasing). Use this when you need to schedule content drops, reminder emails, or sampling days across a month.
Example 3, Weekend-excluded project deadline. Start date: 2024-10-01. End date: 2024-12-31. Exclude weekends: on. Exclude specific dates: 2024-12-25, 2024-12-26. Bulk: 5. You will get five dates that are weekdays and are neither Christmas nor Boxing Day. Common for picking review dates that respect both the working week and the Christmas break.
Example 4, Skip Mondays for a weekly meeting rotation. Start date: 2024-11-04. End date: 2024-12-29. Exclude weekdays: Mon. Bulk: 8. Eight Tuesdays through Sundays, useful for setting up a recurring weekly slot without Mondays.
Example 5, Audit-sample selection across a quarter. Start date: 2024-07-01. End date: 2024-09-30. Exclude weekends: on. Bulk: 15. Fifteen random business days across Q3, perfect for sampling audit visits when you do not want a human's intuition biasing the selection toward the start or end of the quarter.
Where Random Date Picks Show Up
Lottery draws. Any draw that uses dates, "everyone who signed up between date A and date B is eligible", needs an unbiased way to pick a winner. A random date picker is also useful for "draw date" announcements: the lottery itself happens on a specific day, and that day can be picked randomly too.
Project and event scheduling. When a project team needs a kickoff date, deadline, or sprint review date that does not favour any particular person, randomising removes politics from the calendar. The same logic applies to weddings, reunions, and family gatherings.
Sample selection for research. Survey designers, statisticians, and clinical-trial coordinators use random date picks to choose intervention days, follow-up days, or data-extraction days. The key requirement is that every eligible day has an equal probability, exactly what a uniform random pick provides.
Randomised clinical trial assignment. When patients are enrolled over a long recruitment window, a random subset of dates can be used to schedule staggered procedures or batched lab work, balancing the load across weeks.
Gaming nights and tabletop campaigns. Game masters regularly need to pick a "festival day", "founding day", or "treaty signing day" inside a fictional calendar. Even when the world is fictional, players feel better when the date is genuinely random rather than the GM's first thought.
Classroom random-call. Teachers picking a student to answer the next question can rotate by date-of-birth, but a cleaner approach is to pick a random date in the term and ask the student whose birthday falls closest to it. The tool's "exclude weekends" toggle makes it easy to only count school days.
Mystery trips and surprise gifts. "I will book a weekend away for the two of us, date picked at random", a small romantic gesture that also forces the planner out of their comfort zone of "the same place we always go".
Retrospective auditing. Quality auditors sometimes pick random sample dates from a production log: "review every order placed on this randomly chosen day". A reproducible-but-fair selection is essential, and the tool provides that.
Common Mistakes to Avoid
Confusing UTC midnight with local midnight. A JavaScript Date created with new Date('2024-08-15') is parsed as UTC midnight, but new Date(2024, 7, 15) (with explicit numbers) is local midnight. If you mix the two and then print with toISOString(), you can get an off-by-one day error. The generator uses Date.UTC(...) and getUTC* accessors exclusively so the result is timezone-stable.
Leap-year edge cases. February has 29 days in leap years and 28 in common years. Date.UTC(2024, 1, 29) exists; Date.UTC(2023, 1, 29) rolls forward to March. When setting an end date of "Feb 29", browsers handle the rollover gracefully but always double-check with a calendar if the date is mission-critical.
Unix timestamp resolution. Unix timestamps are seconds since the epoch in UTC. Some systems, notably JavaScript's Date#getTime(), return milliseconds. Dividing by 1000 and flooring gives whole seconds. If a downstream system expects milliseconds, multiply back. The generator always emits seconds.
Daylight saving time. Because the generator uses UTC throughout, DST transitions do not affect the output. The date 2024-03-10 is the same UTC date whether your local clock jumped forward or not. This is also why Date.UTC plus a 86,400,000-millisecond increment is safer than new Date(...) + 24*60*60*1000: the former always moves one calendar day in UTC; the latter can drift by an hour across DST boundaries in local time.
Treating ISO 8601 and RFC 2822 as interchangeable. ISO 8601 (2024-08-15) is a calendar date. RFC 2822 (Thu, 15 Aug 2024 00:00:00 +0000) includes the day of the week and a timezone. Many parsers will accept either, but a system that strictly expects RFC 2822 will reject ISO 8601. The generator outputs both so you can pick.
Excluding every day. If you turn on all three exclusions (weekends plus every weekday plus a long list of dates), the eligible pool may be empty. The "eligible of N days" counter under the Generate button tells you how many days remain, if it says 0, loosen at least one exclusion.
Assuming fairness across unequal months. "Pick a random day" with no exclusions gives every day of the year an equal 1/365 (or 1/366) chance. "Pick a random weekday in August" gives every weekday in August an equal chance, including weekdays in past Auguses if your range crosses year boundaries. Always state the range explicitly.
Frequently Asked Questions
How does the generator ensure true randomness? The tool uses the Web Crypto API (crypto.getRandomValues) on browsers that support it. That API is backed by a cryptographically secure pseudo-random number generator seeded by the operating system's entropy pool. For non-security-sensitive applications like scheduling or sampling, this is more than sufficient, the output is statistically indistinguishable from a perfect uniform distribution.
Can I exclude holidays? Yes, but only by adding them one at a time through the "exclude specific dates" picker. The tool does not have a built-in holiday calendar because public holidays vary by country, region, and year. If you regularly need a US holiday calendar, paste the relevant dates into a list and exclude them one by one. For bulk setup, consider building your own preset and pasting the dates.
What is the difference between ISO 8601 and RFC 2822? ISO 8601 is the international standard for date and time representation and looks like 2024-08-15 for a pure date or 2024-08-15T14:30:00Z for a date-time. RFC 2822 is the format originally defined for email and HTTP headers and looks like Thu, 15 Aug 2024 14:30:00 +0000. ISO 8601 is preferred for data interchange; RFC 2822 is preferred when interoperating with email systems or older software that expects a day-of-week prefix.
Why is the Unix timestamp in seconds and not milliseconds? The Unix timestamp is canonically defined as seconds since 1970-01-01 00:00:00 UTC. JavaScript's Date#getTime() returns milliseconds, which is why many JavaScript codebases confuse the two. The generator outputs seconds, which is what most databases, logging systems, and Unix tools expect. If you need milliseconds, multiply the output by 1000.
How do I generate dates for a whole year? Set the start date to 1 January and the end date to 31 December of the desired year. With no exclusions, you get every day in the year as an eligible pick. With "exclude weekends" turned on, you get 261 or 262 weekdays (depending on the year).
What happens if my exclusions leave zero eligible days? The tool detects this case before generating and shows an error: "No dates match the current exclusions. Loosen the rules and try again." You will see the eligible counter hit 0, which is your cue to remove one of the exclusion rules. The error is non-destructive, your settings stay put, so you can adjust and click Generate again.
Can I use this for legal or compliance sampling? Yes, as long as you document the algorithm and the timestamp of the draw. The generator uses crypto.getRandomValues, which is the same source courts and regulators accept for cryptographic key generation. For high-stakes draws, supplement the digital pick with a witness or notarisation so the human chain of custody matches the technical chain.
Is the generator privacy-safe? Yes. Everything runs in your browser using JavaScript. No date pick, exclusion setting, or generated result is ever sent to a server. You can verify this by opening the browser's network tab and watching for zero requests after the page loads.
Standard FAQ
Is this tool free? Yes. The Random Date Generator is completely free to use, with no sign-up, no account, and no usage limits. All processing happens in your browser.
Does it work offline? Yes. After the page has loaded once, your browser caches the JavaScript and CSS. The generator will continue to work without an internet connection. This is also why no generated date ever leaves your device.
References
- RFC 3339, Date and Time on the Internet: Timestamps (Klyne, Newman; 2002). Defines the profile of ISO 8601 used on the modern web. https://www.rfc-editor.org/rfc/rfc3339
- ISO 8601, Date and time format (International Organization for Standardization; 2019). The underlying international standard that RFC 3339 and RFC 2822 both derive from. https://www.iso.org/iso-8601-date-and-time-format.html
- RFC 2822, Internet Message Format (Resnick; 2001). Defines the
Day, DD Mon YYYY HH:MM:SS ยฑZZZZformat used in email headers. https://www.rfc-editor.org/rfc/rfc2822 - MDN Web Docs, Date (Mozilla). Browser reference for the JavaScript
Dateobject, including the UTC accessors this generator relies on. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date - ECMA-262, ECMAScript Language Specification, ยง21.4 Date Objects (Ecma International). The formal specification for how
Date,getTime, andtoISOStringbehave across all conformant JavaScript engines. https://tc39.es/ecma262/#sec-date-objects - Web Crypto API,
Crypto.getRandomValues()(W3C / WICG). The cryptographically secure random source the generator uses when available. https://w3c.github.io/webcrypto/#Crypto-method-getRandomValues