Package net.datafaker.providers.base
Class Time
- Since:
- 1.4.0
-
Field Summary
Fields inherited from class net.datafaker.providers.base.AbstractProvider
faker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGenerates a random time between two times.Generates a string representation of a random time between two times.longfuture(int atMost, int minimum, ChronoUnit unit) Generates a future time from now, with a minimum time.future(int atMost, int minimum, ChronoUnit unit, String pattern) Generates and converts to string representation of a future time from now, with a minimum time.longfuture(int atMost, ChronoUnit unit) Generates a future time from now.future(int atMost, ChronoUnit unit, String pattern) Generates and converts to string representation a future time from now.longpast(int atMost, int minimum, ChronoUnit unit) Generates a past time from now, with a minimum time.past(int atMost, int minimum, ChronoUnit unit, String pattern) Generates and converts to string representation a past time from now, with a minimum time.longpast(int atLeast, ChronoUnit unit) Generates a past time from now.past(int atMost, ChronoUnit unit, String pattern) Generates a string representation of a past time from now.Methods inherited from class net.datafaker.providers.base.AbstractProvider
equals, getFaker, hashCode, loadGenerators, resolve, resolve, toString
-
Constructor Details
-
Time
-
-
Method Details
-
future
Generates a future time from now.- Parameters:
atMost- at most this amount of time ahead from now exclusive.unit- the time unit.- Returns:
- a future time from now.
-
future
Generates and converts to string representation a future time from now.- Parameters:
atMost- at most this amount of time ahead from now exclusive.unit- the time unit.pattern- time pattern to convert to string.- Returns:
- a string representation of a future time from now.
-
future
Generates a future time 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 time from now, with a minimum time.
-
future
Generates and converts to string representation of a future time 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- time pattern to convert to string.- Returns:
- a string representation of a future time from now, with a minimum time.
-
past
Generates a past time from now.- Parameters:
atLeast- at most this amount of time earlier from now exclusive.unit- the time unit.- Returns:
- a past time from now.
-
past
Generates a string representation of a past time from now.- Parameters:
atMost- at most this amount of time earlier from now exclusive.unit- the time unit.pattern- time pattern to convert to string.- Returns:
- a string representation of a past time from now.
-
past
Generates a past time 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 time from now.
-
past
Generates and converts to string representation a past time 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- time pattern to convert to string.- Returns:
- a string representation of a past time from now, with a minimum time.
-
between
Generates a random time between two times.- Parameters:
from- the lower bound inclusiveto- the upper bound exclusive- Returns:
- a random time between
fromandto. - Throws:
IllegalArgumentException- if thetotime represents an earlier time thanfromtime.
-
between
Generates a string representation of a random time between two times.- Parameters:
from- the lower bound inclusiveto- the upper bound exclusivepattern- time pattern to convert to string.- Returns:
- a string representation of a random time between
fromandto. - Throws:
IllegalArgumentException- if thetotime represents an earlier time thanfromtime.
-