I often have to generate random calendar dates so I created this simple online utility that does it for me. It lets you generate however many random years, months, and days you need from any date range. It works in the browser and is powered by alien technology from the future.

Random Date Generator Options

Start and End Date
Count, Separator, Copies
Print only unique calendar dates.
Calendar Date Format
Calendar date format.
Pad date and time parts with zeros.
Print time in 12-hour format with am/pm indicators.

Random Date Generator Examples (click to try!)

Random 21st Century Dates
This example generates random 21st-century calendar dates. The twenty-first century begins on 2001-01-01 00:00:00 and ends on 2100-12-31 23:59:59. The algorithm generates ten random dates and outputs them in the fully padded RFC 3339 time format "YYYY-MM-DD hh:mm:ss" with one random date per line.
2070-03-26 18:57:58
2014-05-11 11:51:20
2005-09-01 15:55:09
2014-07-28 07:15:08
2033-10-17 03:49:58
2058-09-07 19:26:25
2008-07-03 07:21:43
2039-04-12 19:03:14
2066-02-12 02:39:37
2099-08-17 06:38:10
Start calendar date. Format: YYYY-MM-DD HH:MM:SS.
End calendar date. Format: YYYY-MM-DD HH:MM:SS.
How many random calendar dates to generate?
Random calendar date separator.
Filter Date Copies
Use Date Padding
Use 12-hour Clock
Detailed Calendar Dates
This example uses a long range of random dates that cover an entire millennium. The range starts in 1800 and ends in 2800. The list of random date values uses the most verbose format that includes the full name of the day of the week, full month name, date, year, and time in 12-hour clock format. The total number of printed random dates is 12 and they are separated by newlines "\n".
Tuesday, January 26, 1926 04:33:34 am
Sunday, February 11, 1827 07:26:23 pm
Sunday, January 05, 1947 06:13:04 am
Thursday, October 05, 2484 02:01:25 am
Tuesday, November 13, 2187 11:30:40 am
Sunday, December 01, 1957 00:14:38 am
Sunday, September 08, 2571 03:31:33 am
Saturday, May 04, 2599 07:27:26 pm
Thursday, February 10, 2056 01:55:34 am
Friday, March 26, 2799 07:34:31 am
Thursday, March 04, 2297 04:06:39 am
Sunday, September 14, 2166 05:06:29 am
Start calendar date. Format: YYYY-MM-DD HH:MM:SS.
End calendar date. Format: YYYY-MM-DD HH:MM:SS.
How many random calendar dates to generate?
Random calendar date separator.
Filter Date Copies
Use Date Padding
Use 12-hour Clock
Custom Date Format
In this example, we create a sequence of random dates from the year 2030. The sequence contains only the dates with no time component. The date format is set using the custom format mode and the pattern string is "DD MMM YYYY, ddd". This way, each output date consists of the day number, an abbreviation of the month, the year, and an abbreviation of the day of the week. We print 6 random dates and separate them by the pipe symbol. We also activate the date copy filter option that makes sure the program displays only the unique dates.
17 Jan 2030, Thu | 3 Jul 2030, Wed | 23 Mar 2030, Sat | 26 Jul 2030, Fri | 15 Jun 2030, Sat | 27 Dec 2030, Fri
Start calendar date. Format: YYYY-MM-DD HH:MM:SS.
End calendar date. Format: YYYY-MM-DD HH:MM:SS.
How many random calendar dates to generate?
Random calendar date separator.
Filter Date Copies
Custom output date format. Notation: YYYY/YY – year, MMMM/MMM/MM – month, DD – day, dddd/ddd – day of week, hh – hour, mm – minute, ss – second.
Use Date Padding
Use 12-hour Clock

How Does This Random Date Generator Work?

This random calendar date generator works entirely in your browser and is written in JavaScript. It generates random dates from the calendar range startDate to endDate, which are specified in the options and use the YYYY-MM-DD HH:MM:SS format. If you are working with just dates, then you can skip the hours, minutes, seconds part (the HH:MM:SS part) as it's optional. The key idea that this program uses is that any point in time can be represented as a single integer number – the Unix timestamp (also known as the Unix Epoch). It's defined as the number of seconds that have passed since midnight (00:00:00 UTC) of Jan 1, 1970. It can be both a positive number (for example, 120 would be Jan 1, 1970 00:02:00) or a negative number (for example, -120 would be Dec 31, 1969, 23:58:00). To convert the date strings in the options to Unix time, the program uses a date parser that extracts the year y, month mo, day d, hour h, minute m, second s from startDate and endDate. If the clock time part is not specified, it's assumed to be 00:00:00. If the date or month components are not specified, then they are set to Jan 1. If the input time range is entered in 12-hour format, it's internally converted to a 24-hour format so that it was easier to work with. The program converts both input dates to the Coordinated Universal Time, as it's not adjusted for daylight saving time (so there are no surprises of missing hours). The UTC date is constructed via date = new Date(Date.UTC(y, mo, d, h, m, s)) and it's then converted to Unix time via startTimestamp = date.getTime()/1000. Now the problem of generating a random date simply becomes a problem of generating random integers from the range [startTimestamp, endTimestamp]. Each picked integer is then converted back to UTC time via the formula new Date(randTimestamp*1000) and then it's formatted to the necessary output format. The output format is represented as a string with the following keywords for various date and time parts: year YYYY or YY; month MMMM, MMM, or MM; day DD; day of the week dddd, ddd, or dd; hour hh; minute mm; and second ss. The formatting is performed by finding each date/time component X with date.getUTCX() and then substituting it back into the string via str.replace() function. The required number of dates are generated in a for loop that runs count times (specified in options). The results are stored in the array randDates. If the duplicate date filter option is enabled, the program checks the uniqueness of each randDate by keeping a track of already generated dates is in the seenDates object. At the end of the loop, the program calls randDates.join() function and returns all dates, joined via separator to the screen.

Created by Browserling

This random date generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by our programmer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my tools, then I love you, too! Use coupon code TOOLLING to get a discount at my company.