How to Generate Random Dates Between Two Dates (and Pick a Format)

Generate random dates in a range for test data, schedules and audits: weekday filters, unique dates, ISO, US and European formats, Unix time and time zones.

Updated September 29, 2026 5 min read

Use the free Random Date GeneratorRandom dates between two dates, weekdays or weekends only, with optional times

Random dates come up in more places than you might expect. A developer needs order dates spread across last year to test a reporting dashboard. An auditor wants to sample random working days to check timesheets. A teacher sets surprise quiz days across a term. A game master needs a birthday for a character born sometime in the 1980s. Typing dates by hand produces clusters and patterns; a spreadsheet formula works but gets fiddly with weekdays and formats.

This guide explains how random dates are picked fairly within a range, how filters for weekdays and weekends work, how to choose between ISO, US, European and Unix formats, and the time zone traps that catch people out.

How random dates are chosen

A date range is really a list of days. From 1 January to 31 December in a non-leap year there are 365 days; a fair generator gives each of them the same chance. The standard approach is to convert both dates to day numbers, pick a random whole number between them (inclusive), and convert it back.

With or without duplicates

  • Unique dates are like drawing cards from a deck: once a date is picked, it is out. Use this for audit samples, schedules and anything where the same day twice would be odd.
  • Dates with repeats allowed are like rolling dice: the same date can come up more than once. That is realistic for test data such as order dates, where many orders happen on the same day.

Filtering by day of the week

Weekday-only filters are essential for business scenarios. Of every seven days, five are weekdays (Monday to Friday) and two are weekend days. A filter simply removes the unwanted days from the pool before picking, so each remaining day is still equally likely. Public holidays vary by country and are not part of a simple weekday filter; remove them by hand if they matter.

Date formats compared

The same date can be written in several ways, and mixing them up causes real errors:

Format Example (14 March 2025) Where it is common
ISO 8601 2025-03-14 Databases, APIs, file names, international use
US 03/14/2025 United States
European 14/03/2025 UK, Europe, much of the world
Long Friday, 14 March 2025 Documents, invitations
Unix timestamp 1741910400 Programming, logs

A date such as 04/05/2025 is 5 April in the US and 4 May in Europe. ISO 8601 avoids that ambiguity and also sorts correctly as plain text, which is why it is the safest choice for data. A Unix timestamp counts seconds since 1 January 1970 in UTC; you can convert it back with a Unix Timestamp Converter.

Generate random dates with our tool

The Random Date Generator runs in your browser.

  1. Open the Random Date Generator. The range starts as the current calendar year.
  2. Set the Start date and End date. Both are included in the range. If you enter them the wrong way round, the tool swaps them.
  3. Enter How many dates, from 1 to 1,000.
  4. Under Days, choose Any day, Weekdays (Mon–Fri) or Weekends only.
  5. Pick an Output format: ISO 8601, US, European, Long, or Unix timestamp (UTC).
  6. Choose options: No duplicate dates, Sort chronologically, and Include a random time (adds a random hour and minute).
  7. Click Generate dates. Copy the list or download it as a text file.

If you ask for more unique dates than exist in the range (say, 30 weekend days in a single month), the tool shows every matching date and tells you how many there were.

Other ways to generate random dates

Excel and Google Sheets. Dates are stored as numbers, so =RANDBETWEEN(DATE(2025,1,1), DATE(2025,12,31)) returns a random date; format the cell as a date. For weekdays only, you can combine it with WORKDAY, but moving weekend picks to the nearest working day makes the days next to weekends more likely than the others. The values also recalculate whenever the sheet changes, so paste them as values once you are happy.

Programming languages. Most languages can add a random number of days to a start date. In test suites that is the right place to do it, ideally with a fixed seed so tests are repeatable.

Test data generators. When you need dates alongside names, emails and addresses, a Fake Data Generator produces complete records in one go.

Time zones and other pitfalls

Why a date can "shift by one day"

Many programs store dates as a moment in time, usually midnight in some time zone. Displayed in a different zone, midnight on 14 March in London can appear as 13 March in New York. Our generator treats dates as calendar days in UTC, so daylight saving changes never move a date. When you import the results into another system, import them as plain dates, not date-times, if you can.

Random times are UTC

When you include a random time, the time and any Unix timestamp are in UTC. If you need local times, add or subtract your offset after generating, or use a converter.

Leap years

A range including 29 February in a leap year will include that date like any other. Ranges spanning several years automatically contain the right number of days.

Very wide ranges

For unique dates, the range must be under roughly 500 years. That covers any realistic use; for wider spans, allow duplicates.

Checking the spread

To see how far apart two generated dates are, or to check a range length, use the Date Difference Calculator. For the underlying method, see how to count days between two dates.

Frequently asked questions

Are the start and end dates included?

Yes. Both dates are part of the range and can be picked.

Can I generate only working days?

Choose Weekdays (Mon–Fri). Public holidays are not excluded automatically, so remove them yourself if needed.

Which format should I use for spreadsheets?

ISO 8601 (YYYY-MM-DD) is recognised by most spreadsheet apps regardless of regional settings and sorts correctly.

Can I get a random time as well?

Yes. Switch on Include a random time to add a random hour and minute in UTC to each date.

Can the same date appear twice?

Only if you switch off No duplicate dates. With it on, every date in the list is different.

Try it now: Random Date Generator

Loading tool…