Package org.pipservices3.commons.random
Class RandomDateTime
java.lang.Object
org.pipservices3.commons.random.RandomDateTime
Random generator for Date time values.
### Example ###
ZonedDateTime value1 = RandomDateTime.nextDate(2010, 0); // Possible result: 2008-01-03
ZonedDateTime value2 = RandomDateTime.nextDateTime(2017, 0);// Possible result: 20017-03-11 11:20:32
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ZonedDateTime
nextDate
(int minYear, int maxYear) Generates a random ZonedDateTime in the range ['minYear', 'maxYear'].static ZonedDateTime
nextDateTime
(int minYear, int maxYear) Generates a random ZonedDateTime and time in the range ['minYear', 'maxYear'].static ZonedDateTime
updateDateTime
(ZonedDateTime value) Updates (drifts) a ZonedDateTime value.static ZonedDateTime
updateDateTime
(ZonedDateTime value, float range) Updates (drifts) a ZonedDateTime value within specified range defined
-
Constructor Details
-
RandomDateTime
public RandomDateTime()
-
-
Method Details
-
nextDate
Generates a random ZonedDateTime in the range ['minYear', 'maxYear']. This method generate dates without time (or time set to 00:00:00)- Parameters:
minYear
- (optional) minimum range valuemaxYear
- max range value- Returns:
- a random ZonedDateTime value.
-
nextDateTime
Generates a random ZonedDateTime and time in the range ['minYear', 'maxYear']. This method generate dates without time (or time set to 00:00:00)- Parameters:
minYear
- (optional) minimum range valuemaxYear
- max range value- Returns:
- a random ZonedDateTime and time value.
-
updateDateTime
Updates (drifts) a ZonedDateTime value.- Parameters:
value
- a ZonedDateTime value to drift.- Returns:
- an updated ZonedDateTime and time value.
-
updateDateTime
Updates (drifts) a ZonedDateTime value within specified range defined- Parameters:
value
- a ZonedDateTime value to drift.range
- (optional) a range in milliseconds. Default: 10 days- Returns:
- an updated ZonedDateTime and time value.
-