public class DateAndTime
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
DateAndTime(Faker faker) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Date |
between(java.util.Date from,
java.util.Date to)
Generates a random date between two dates.
|
java.util.Date |
birthday()
Generates a random birthday between 65 and 18 years ago.
|
java.util.Date |
birthday(int minAge,
int maxAge)
Generates a random birthday between two ages.
|
java.util.Date |
future(int atMost,
java.util.concurrent.TimeUnit unit)
Generates a future date from now.
|
java.util.Date |
future(int atMost,
java.util.concurrent.TimeUnit unit,
java.util.Date referenceDate)
Generates a future date relative to the
referenceDate. |
java.util.Date |
past(int atMost,
java.util.concurrent.TimeUnit unit)
Generates a past date from now.
|
java.util.Date |
past(int atMost,
java.util.concurrent.TimeUnit unit,
java.util.Date referenceDate)
Generates a past date relative to the
referenceDate. |
protected DateAndTime(Faker faker)
public java.util.Date future(int atMost,
java.util.concurrent.TimeUnit unit)
atMost - at most this amount of time ahead from now exclusive.unit - the time unit.public java.util.Date future(int atMost,
java.util.concurrent.TimeUnit unit,
java.util.Date referenceDate)
referenceDate.atMost - at most this amount of time ahead to the referenceDate exclusive.unit - the time unit.referenceDate - the future date relative to this date.referenceDate.public java.util.Date past(int atMost,
java.util.concurrent.TimeUnit unit)
atMost - at most this amount of time earlier from now exclusive.unit - the time unit.public java.util.Date past(int atMost,
java.util.concurrent.TimeUnit unit,
java.util.Date referenceDate)
referenceDate.atMost - at most this amount of time past to the referenceDate exclusive.unit - the time unit.referenceDate - the past date relative to this date.referenceDate.public java.util.Date between(java.util.Date from,
java.util.Date to)
throws java.lang.IllegalArgumentException
from - the lower bound inclusiveto - the upper bound exclusivefrom and to.java.lang.IllegalArgumentException - if the to date represents an earlier date than from date.public java.util.Date birthday()
public java.util.Date birthday(int minAge,
int maxAge)
minAge - the minimal agemaxAge - the maximal ageminAge and maxAge years ago.java.lang.IllegalArgumentException - if the maxAge is lower than minAge.Copyright © 2018. All Rights Reserved.