spacepy.time.randomDate

spacepy.time.randomDate(dt1, dt2, N=1, tzinfo=False, sorted=False)[source]

Return a (or many) random datetimes between two given dates

Convention used is dt1 <= rand < dt2. Leap second times will not be returned.

Parameters:
dt1datetime.datetime

start date for the the random date

dt2datetime.datetime

stop date for the the random date

Returns:
outdatetime.datetime or numpy.ndarray of datetime.datetime

the new time for the next call to EventTimer

Other Parameters:
Nint (optional)

the number of random dates to generate (defualt=1)

tzinfobool (optional)

maintain the tzinfo of the input datetimes (default=False)

sortedbool (optional)

return the times sorted (default=False)