RandomDate
gives a pseudorandom date in the current calendar year.
RandomDate[{datemin,datemax}]
gives a pseudorandom date between the dates datemin and datemax.
RandomDate[date]
gives a pseudorandom date between the start and end of the calendar period date.
RandomDate[quantity]
gives a pseudorandom date between now and the time quantity duration from now.
RandomDate[range,n]
gives a list of n pseudorandom dates.
Details and Options
- RandomDate is used to generate dates within a particular time period (i.e. a given year, month, day or a set of arbitrary points in time).
- RandomDate[{datemin,datemax}] chooses dates with a uniform probability distribution between datemin and datemax.
- RandomDate[date] gives a date between the beginning and end of the specified date, based on its granularity, and is equivalent to RandomDate[DateBounds[date]]. Specifications for date may be a DateObject, TimeObject or DateInterval.
- RandomDate[quantity] gives a date between Now and Now+quantity, where quantity is a duration specified using Quantity with a time unit. RandomDate[{quantitymin,quantitymax}] gives a date between Now+quantitymin and Now+quantitymax.
- RandomDate[range,{n1,n2,…}] gives an n1×n2×… array of pseudorandom dates.
- The following options can be specified for generated dates:
-
DateGranularity Automatic granularity of generated dates CalendarType Automatic calendar system of generated dates DateFormat Automatic display format of generated dates TimeSystem Automatic time system of generated daes TimeZone Automatic time zone of generated dates - RandomDate gives a different sequence of pseudorandom dates whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
Examples
open allclose allBasic Examples (7)
Scope (3)
Generate random dates from a DateObject:
Generate random dates from a TimeObject:
Generate random dates from a DateInterval:
For discontinuous intervals, dates will be uniformly sampled across all interval segments:
Options (5)
DateGranularity (1)
By default, dates are generated with "Instant" granularity:
Use DateGranularity"Day" to generate a pseudorandom day:
Text
Wolfram Research (2022), RandomDate, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomDate.html.
CMS
Wolfram Language. 2022. "RandomDate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomDate.html.
APA
Wolfram Language. (2022). RandomDate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomDate.html