org.flexiblepower.time
public final class TimeUtil extends java.lang.Object
Date objects and
Measurable<Duration> objects.| Modifier and Type | Field and Description |
|---|---|
static Unit<Duration> |
MS
Represents Milliseconds.
|
static Measurable<Duration> |
ZERO
Represents a duration with no length.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.Date |
add(java.util.Date startDate,
Measurable<Duration> duration)
Adds a duration to a date to get another
Date object. |
static Measurable<Duration> |
difference(java.util.Date startDate,
java.util.Date endDate)
Calculates the difference between 2 dates.
|
static java.util.Date |
subtract(java.util.Date startDate,
Measurable<Duration> duration)
Subtracts a duration from a date to get another
Date object. |
public static final Measurable<Duration> ZERO
public static java.util.Date add(java.util.Date startDate,
Measurable<Duration> duration)
Date object.startDate - The starting timeduration - The duration to addDate object that represents the time that is duration after the
startDate.java.lang.NullPointerException - when any of the parameters is nullpublic static java.util.Date subtract(java.util.Date startDate,
Measurable<Duration> duration)
Date object.startDate - The starting timeduration - The duration to subtractDate object that represents the time that is duration before the
startDate.java.lang.NullPointerException - when any of the parameters is nullpublic static Measurable<Duration> difference(java.util.Date startDate, java.util.Date endDate)
startDate - The starting dateendDate - The ending dateMeasurable object that represents the difference between the 2 dates.java.lang.NullPointerException - when any of the parameters is null