Package net.datafaker.providers.base
Class DateAndTime
java.lang.Object
net.datafaker.providers.base.AbstractProvider<BaseProviders>
net.datafaker.providers.base.DateAndTime
@Deprecated(since="2.3.0",
forRemoval=true)
public class DateAndTime
extends AbstractProvider<BaseProviders>
Deprecated, for removal: This API element is subject to removal in a future version.
A generator of random dates.
- Since:
- 0.8.0
- Author:
- pmiklos
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDeprecated, for removal: This API element is subject to removal in a future version.Fields inherited from class net.datafaker.providers.base.AbstractProvider
faker -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDateAndTime(BaseProviders faker) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescription<T extends Date>
Tbetween(T from, T to) Deprecated, for removal: This API element is subject to removal in a future version.Generates a random date between two dates.Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a random date between two dates.birthday()Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between 65 and 18 years ago from now.birthday(int minAge, int maxAge) Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between two ages from now.Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a random birthday between two ages from now.Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a random birthday between 65 and 18 years ago from now.Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between 65 and 18 years ago from now as LocalDate.birthdayLocalDate(int minAge, int maxAge) Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between two ages from now as LocalDate.Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration between min and max.duration(long min, long max, ChronoUnit unit) Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration between min and max.Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration lower than max.duration(long max, ChronoUnit unit) Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration lower than max.Deprecated, for removal: This API element is subject to removal in a future version.Generates a future date from now, with a minimum time.Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation of a future date from now, with a minimum time.Deprecated, for removal: This API element is subject to removal in a future version.Generates a future date from now.Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a future date from now.<T extends Date>
TDeprecated, for removal: This API element is subject to removal in a future version.Generates a future date relative to thereferenceDate.Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a future date relative to thereferenceDate.Deprecated, for removal: This API element is subject to removal in a future version.Generates a past date from now, with a minimum time.Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a past date from now, with a minimum time.Deprecated, for removal: This API element is subject to removal in a future version.Generates a past date from now.Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a past date from now.Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a past date relative to thereferenceDate.<T extends Date>
TDeprecated, for removal: This API element is subject to removal in a future version.Generates a past date relative to thereferenceDate.Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Period between min and max.Methods inherited from class net.datafaker.providers.base.AbstractProvider
equals, getFaker, hashCode, loadGenerators, resolve, resolve, toString
-
Field Details
-
DAYS_NANOS
public static final long DAYS_NANOSDeprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
DateAndTime
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
future
Deprecated, for removal: This API element is subject to removal in a future version.Generates a future date from now.- Parameters:
atMost- at most this amount of time ahead from now exclusive.unit- the time unit.- Returns:
- a future date from now.
-
future
Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a future date from now.- Parameters:
atMost- at most this amount of time ahead from now exclusive.unit- the time unit.pattern- date time pattern to convert to string.- Returns:
- a string representation of a future date from now.
-
future
Deprecated, for removal: This API element is subject to removal in a future version.Generates a future date from now, with a minimum time.- Parameters:
atMost- at most this amount of time ahead from now exclusive.minimum- the minimum amount of time in the future from now.unit- the time unit.- Returns:
- a future date from now, with a minimum time.
-
future
Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation of a future date from now, with a minimum time.- Parameters:
atMost- at most this amount of time ahead from now exclusive.minimum- the minimum amount of time in the future from now.unit- the time unit.pattern- date time pattern to convert to string.- Returns:
- a string representation of a future date from now, with a minimum time.
-
future
Deprecated, for removal: This API element is subject to removal in a future version.Generates a future date relative to thereferenceDate.- Parameters:
atMost- at most this amount of time ahead to thereferenceDateexclusive.unit- the time unit.referenceDate- the future date relative to this date.- Returns:
- a future date relative to
referenceDate.
-
future
Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a future date relative to thereferenceDate.- Parameters:
atMost- at most this amount of time ahead to thereferenceDateexclusive.unit- the time unit.referenceDate- the future date relative to this date.pattern- date time pattern to convert to string.- Returns:
- a string representation of a future date relative to
referenceDate.
-
past
Deprecated, for removal: This API element is subject to removal in a future version.Generates a past date from now.- Parameters:
atMost- at most this amount of time earlier from now exclusive.unit- the time unit.- Returns:
- a past date from now.
-
past
Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a past date from now.- Parameters:
atMost- at most this amount of time earlier from now exclusive.unit- the time unit.pattern- date time pattern to convert to string.- Returns:
- a string representation of a past date from now.
-
past
Deprecated, for removal: This API element is subject to removal in a future version.Generates a past date from now, with a minimum time.- Parameters:
atMost- at most this amount of time earlier from now exclusive.minimum- the minimum amount of time in the past from now.unit- the time unit.- Returns:
- a past date from now.
-
past
Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a past date from now, with a minimum time.- Parameters:
atMost- at most this amount of time earlier from now exclusive.minimum- the minimum amount of time in the past from now.unit- the time unit.pattern- date time pattern to convert to string.- Returns:
- a string representation of a past date from now, with a minimum time.
-
past
Deprecated, for removal: This API element is subject to removal in a future version.Generates a past date relative to thereferenceDate.- Parameters:
atMost- at most this amount of time past to thereferenceDateexclusive.unit- the time unit.referenceDate- the past date relative to this date.- Returns:
- a past date relative to
referenceDate.
-
past
Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a past date relative to thereferenceDate.- Parameters:
atMost- at most this amount of time past to thereferenceDateexclusive.unit- the time unit.referenceDate- the past date relative to this date.pattern- date time pattern to convert to string.- Returns:
- a string representation of a past date relative to
referenceDate.
-
between
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random date between two dates.- Parameters:
from- the lower bound inclusiveto- the upper bound exclusive- Returns:
- a random date between
fromandto. - Throws:
IllegalArgumentException- if thetodate represents an earlier date thanfromdate.
-
between
public <T extends Date> String between(T from, T to, String pattern) throws IllegalArgumentException Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a random date between two dates.- Parameters:
from- the lower bound inclusiveto- the upper bound exclusivepattern- date time pattern to convert to string.- Returns:
- a string representation of a random date between
fromandto. - Throws:
IllegalArgumentException- if thetodate represents an earlier date thanfromdate.
-
birthday
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between 65 and 18 years ago from now.- Returns:
- a random birthday between 65 and 18 years ago from now.
-
birthdayLocalDate
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between 65 and 18 years ago from now as LocalDate.- Returns:
- a random birthday between 65 and 18 years ago from now.
-
birthday
Deprecated, for removal: This API element is subject to removal in a future version.Generates a string representation of a random birthday between 65 and 18 years ago from now.- Parameters:
pattern- date time pattern to convert to string.- Returns:
- a string representation of a random birthday between 65 and 18 years ago from now.
-
birthday
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between two ages from now.- Parameters:
minAge- the minimal agemaxAge- the maximal age- Returns:
- a random birthday between
minAgeandmaxAgeyears ago from now. NegativeminAgeandmaxAgeare supported.
-
birthdayLocalDate
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random birthday between two ages from now as LocalDate.- Parameters:
minAge- the minimal agemaxAge- the maximal age- Returns:
- a random birthday between
minAgeandmaxAgeyears ago from now. NegativeminAgeandmaxAgeare supported.
-
birthday
Deprecated, for removal: This API element is subject to removal in a future version.Generates and converts to string representation a random birthday between two ages from now.- Parameters:
minAge- the minimal agemaxAge- the maximal agepattern- date time pattern to convert to string.- Returns:
- a string representation of a random birthday between
minAgeandmaxAgeyears ago from now. - Throws:
IllegalArgumentException- if themaxAgeis lower thanminAge.
-
duration
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration lower than max.- Parameters:
max- the maximum value (exclusive in most cases)unit- the temporal unit (day or shorter than a day)- Returns:
- a random Duration lower than
max. - Throws:
IllegalArgumentException- if theunitis invalid.
-
duration
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration between min and max.- Parameters:
min- the minimum value (inclusive)max- the maximum value (exclusive in most cases)unit- the temporal unit (day or shorter than a day)- Returns:
- a random Duration between
mininclusive andmaxexclusive ifmaxgreatermin. - Throws:
IllegalArgumentException- if theunitis invalid.
-
duration
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration lower than max.- Parameters:
max- the maximum valueunit- the temporal unit (day or shorter than a day)- Returns:
- a random Duration lower than
max. - Throws:
IllegalArgumentException- if theunitis invalid.
-
duration
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Duration between min and max.- Parameters:
min- the minimal valuemax- the maximum valueunit- the temporal unit (day or shorter than a day)- Returns:
- a random Duration between
mininclusive andmaxexclusive ifmaxgreatermin. - Throws:
IllegalArgumentException- if theunitis invalid.
-
period
Deprecated, for removal: This API element is subject to removal in a future version.Generates a random Period between min and max.- Parameters:
min- the minimal valuemax- the maximum value- Returns:
- a random Period between
mininclusive andmaxinclusive ifmaxgreatermin. - Throws:
IllegalArgumentException- if theminis greater thanmax.
-
TimeAndDateinstead.