public static enum Duration.FormatStyle extends Enum<Duration.FormatStyle>
| Enum Constant and Description |
|---|
FULL
Formats a time duration in the following format:
H:M:s:ns. |
ISO_8601
Formats a time duration using ISO-8601 seconds based representation, such as
PT8H6M12.345S. |
SHORT
Formats a time duration in any of the following formats:
H:M:s:ns,
M:S:ns, or S.ns, always choosing the shortest possible format. |
SHORTER
Formats a time duration in any of the following formats:
H:M:s:ns,
M:S:ns, or S.ns, suppressing trailing zeros from the nanosecond part. |
| Modifier and Type | Method and Description |
|---|---|
abstract String |
format(Duration duration,
boolean printLegend)
Formats a time duration.
|
static Duration.FormatStyle |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Duration.FormatStyle[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Duration.FormatStyle FULL
H:M:s:ns. For example:
1:59:59.987654321public static final Duration.FormatStyle SHORT
H:M:s:ns,
M:S:ns, or S.ns, always choosing the shortest possible format.
Examples:
0.001000000 second(s)3.200000000 second(s)15:00.005890000 minute(s)public static final Duration.FormatStyle SHORTER
H:M:s:ns,
M:S:ns, or S.ns, suppressing trailing zeros from the nanosecond part.
Examples:
0.001 second(s)3.2 second(s)15:00.00589 minute(s)public static final Duration.FormatStyle ISO_8601
PT8H6M12.345S.
Examples:
PT0.001SPT3.2SPT15M0.00589Spublic static Duration.FormatStyle[] values()
for (Duration.FormatStyle c : Duration.FormatStyle.values()) System.out.println(c);
public static Duration.FormatStyle valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2020. All rights reserved.