java.lang.Object
io.github.astrapi69.random.date.RandomDateFactory
The factory class
RandomDateFactory
for creating random Date objects-
Method Summary
Modifier and TypeMethodDescriptionstatic Date
Creates a random birthday-date between 9 and 55 years.static Date
randomBirthday
(Date from, Date till) Creates a random birthday-date between the two given date-objects.static Date
Creates a randomDate
static Date
randomDate
(SecureRandom secureRandom) Creates a randomDate
static Date
randomDate
(Date from) Creates a random date.static Date
randomDate
(Date from, SecureRandom secureRandom) Creates a random date.static Date
randomDateAfter
(Date date) Creates a random Date that is after from the given Date.static Date
randomDateAfter
(Date date, int range) Creates a random Date that is after from the given Date.static Date
randomDateAfter
(Date date, int range, SecureRandom secureRandom) Creates a random Date that is after from the given Date.static Date
randomDateBefore
(Date date) Creates a random date that is before from the given date.static Date
randomDateBefore
(Date date, int range) Creates a random date that is before from the given date.static Date
randomDateBefore
(Date date, int range, SecureRandom secureRandom) Creates a random date that is before from the given date.static String
randomDatebetween
(long startDate, long endDate) Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the default "dd.MM.yyyy HH:mm:ss" format.static String
randomDatebetween
(long startDate, long endDate, String format) Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the given format.static Date
randomDatebetween
(Date start, Date end) Creates a random Date between the range from start and end.static String
randomDateBetween
(long startDate, long endDate, String format, SecureRandom secureRandom) Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the given format.static Date
randomDateBetween
(Date from, int startDays, int endDays) Creates a random Date between the range from startDays and endDays from the given Date.static Date
randomDateBetween
(Date start, Date end, SecureRandom secureRandom) Creates a random Date between the range from start and end.static LocalDate
Creates a randomLocalDate
objectstatic LocalDateTime
Creates a randomLocalDateTime
objectstatic LocalTime
Creates a randomLocalTime
objectstatic ZoneId
Creates a randomLocalDateTime
object
-
Method Details
-
randomBirthday
Creates a random birthday-date between 9 and 55 years.- Returns:
- 's the random date.
-
randomBirthday
Creates a random birthday-date between the two given date-objects.- Parameters:
from
- The date from where to start.till
- The date from where to end.- Returns:
- 's the random date.
-
randomDateAfter
Creates a random Date that is after from the given Date.- Parameters:
date
- The Date from where to compute the future date.- Returns:
- The random Date in the future.
-
randomDateAfter
Creates a random Date that is after from the given Date.- Parameters:
date
- The Date from where to compute the future date.range
- The range.- Returns:
- The random Date in the future.
-
randomDateAfter
Creates a random Date that is after from the given Date.- Parameters:
date
- The Date from where to compute the future date.range
- The range.secureRandom
- the secure random for Date generation- Returns:
- The random Date in the future.
-
randomDateBefore
Creates a random date that is before from the given date.- Parameters:
date
- The date from where to compute the Past date.- Returns:
- The random Date in the past.
-
randomDateBefore
Creates a random date that is before from the given date.- Parameters:
date
- The date from where to compute the past date.range
- The range.- Returns:
- The random Date in the past.
-
randomDateBefore
Creates a random date that is before from the given date.- Parameters:
date
- The date from where to compute the past date.range
- The range.secureRandom
- the secure random for Date generation- Returns:
- The random Date in the past.
-
randomDate
Creates a randomDate
- Returns:
- The random
Date
-
randomDate
Creates a random date.- Parameters:
from
- The date from where to begin.- Returns:
- The random date.
-
randomDate
Creates a random date.- Parameters:
from
- The date from where to begin.secureRandom
- the secure random for date generation- Returns:
- The random date.
-
randomDate
Creates a randomDate
-
randomDateBetween
Creates a random Date between the range from start and end.- Parameters:
start
- The Date from where the range starts.end
- The Date from where the range ends.secureRandom
- the secure random for date generation- Returns:
- A random Date between the range from start and end.
-
randomDateBetween
public static String randomDateBetween(long startDate, long endDate, String format, SecureRandom secureRandom) Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the given format.- Parameters:
startDate
- The date from where to start as a long.endDate
- The date from where to end as a long.format
- The format for the date.secureRandom
- the secure random for String generation- Returns:
- The random date as a String.
-
randomDatebetween
Creates a random Date between the range from start and end.- Parameters:
start
- The Date from where the range starts.end
- The Date from where the range ends.- Returns:
- A random Date between the range from start and end.
-
randomDatebetween
Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the default "dd.MM.yyyy HH:mm:ss" format.- Parameters:
startDate
- The date from where to start as a long.endDate
- The date from where to end as a long.- Returns:
- The random date as a String.
-
randomDatebetween
Creates a random Date between the range from startDays and endDays from the given Date and gives it back as a string to the given format.- Parameters:
startDate
- The date from where to start as a long.endDate
- The date from where to end as a long.format
- The format for the date.- Returns:
- The random date as a String.
-
randomDateBetween
Creates a random Date between the range from startDays and endDays from the given Date.- Parameters:
from
- The Date from where to the random Date to start.startDays
- The int that represents the days from where the range starts.endDays
- The int that represents the days from where the range ends.- Returns:
- A random Date between the range from startDays and endDays from the given Date.
-
randomLocalDate
Creates a randomLocalDate
object- Returns:
- the random
LocalDate
object
-
randomLocalDateTime
Creates a randomLocalDateTime
object- Returns:
- the random
LocalDateTime
object
-
randomLocalTime
Creates a randomLocalTime
object- Returns:
- the random
LocalTime
object
-
randomZoneId
Creates a randomLocalDateTime
object- Returns:
- the zone id
-