Random date in range

The random date in range policy generates a randomly selected date within a specified date range. There are several formats available for the masked date.

JavaScript policy syntax

This policy is available with the function DateMask.randomDateInRange().

DateMask.randomDateInRange(<arg:startDate>, <arg:endDate>, <arg:dateFormat>)

For example, to generate random dates from January 1, 1999 to January 1, 2009 in the MM-dd-yyyy format, use the following syntax:

DateMask.randomDateInRange('1999-01-01', '2009-01-01', 'MM-dd-yyyy')

Argument Description
endDate The end date of the date range in yyyy-MM-dd format.
startDate The start date of the date range in yyyy-MM-dd format.
dateFormat The format of the masked date. The default is yyyy-MM-dd. The following formats are supported:
  • dd-MM-yyyy
  • dd-MM-yyyy HH:mm:ss
  • MM-dd-yyyy
  • MM-dd-yyyy HH:mm:ss
  • MMM dd, yyyy
  • yyyy-MM-dd