Package megamek.common.util
Class DateUtilities
java.lang.Object
megamek.common.util.DateUtilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalDategetRandomDateBetween(LocalDate start, LocalDate end) Returns a randomLocalDatebetween the given start (inclusive) and end (inclusive) dates.
-
Constructor Details
-
DateUtilities
public DateUtilities()
-
-
Method Details
-
getRandomDateBetween
Returns a randomLocalDatebetween the given start (inclusive) and end (inclusive) dates.This method converts both start and end dates to their epoch day representations, selects a random day within that range, and constructs a
LocalDatefrom the random epoch day.- Parameters:
start- the earliest date to select (inclusive)end- the latest date to select (inclusive)- Returns:
- a randomly selected
LocalDatebetweenstartandend, inclusive - Throws:
IllegalArgumentException- ifstartis afterend
-