public class RandomDateExtensions extends Object
RandomDateExtensions is a utility class for creating random random dates.| Constructor and Description |
|---|
RandomDateExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static Date |
dateAfter(Date date)
Creates a random Date that is after from the given Date.
|
static Date |
dateAfter(Date date,
int range)
Creates a random Date that is after from the given Date.
|
static Date |
dateBefore(Date date)
Creates a random date that is before from the given date.
|
static Date |
dateBefore(Date date,
int range)
Creates a random date that is before from the given date.
|
static Timestamp |
getTimestamp()
Creates a java.sql.Timestamp from now.
|
static Timestamp |
getTimestamp(Date date)
Creates a java.sql.Timestamp(to match the ones in the database) from the given date.
|
static Date |
randomBirthday()
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 |
randomDate()
Creates a random
Date |
static Date |
randomDate(Date from)
Creates a random date.
|
static Date |
randomDatebetween(Date start,
Date end)
Creates a random Date between the range from start and end.
|
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 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 LocalDate |
randomLocalDate()
Creates a random
LocalDate object |
static LocalDateTime |
randomLocalDateTime()
Creates a random
LocalDateTime object |
static LocalTime |
randomLocalTime()
Creates a random
LocalTime object |
static ZoneId |
randomZoneId()
Creates a random
LocalDateTime object |
public static Date dateAfter(Date date)
date - The Date from where to compute the future date.public static ZoneId randomZoneId()
LocalDateTime objectpublic static LocalDateTime randomLocalDateTime()
LocalDateTime objectLocalDateTime objectpublic static LocalTime randomLocalTime()
LocalTime objectLocalTime objectpublic static LocalDate randomLocalDate()
LocalDate objectLocalDate objectpublic static Date dateAfter(Date date, int range)
date - The Date from where to compute the future date.range - The range.public static Date dateBefore(Date date)
date - The date from where to compute the Past date.public static Date dateBefore(Date date, int range)
date - The date from where to compute the past date.range - The range.public static Timestamp getTimestamp()
public static Timestamp getTimestamp(Date date)
date - The datepublic static Date randomBirthday()
public static Date randomBirthday(Date from, Date till)
from - The date from where to start.till - The date from where to end.public static Date randomDate(Date from)
from - The date from where to begin.public static Date randomDatebetween(Date start, Date end)
start - The Date from where the range starts.end - The Date from where the range ends.public static String randomDatebetween(long startDate, long endDate)
startDate - The date from where to start as a long.endDate - The date from where to end as a long.public static String randomDatebetween(long startDate, long endDate, String format)
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.public static Date randomDateBetween(Date from, int startDays, int endDays)
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.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.