| Enum Constant and Description |
|---|
DAY
Represents a day which has short name d.
|
HOUR
Represents an hour which has short name h.
|
MICROSECOND
Represents a microsecond which has short name us.
|
MILLISECOND
Represents a millisecond which has short name ms.
|
MINUTE
Represents a minute which has short name min.
|
NANOSECOND
Represents a nanosecond which has short name ns.
|
SECOND
Represents a second which has short name s.
|
WEEK
Represents a week which has short name w.
|
| Modifier and Type | Method and Description |
|---|---|
static double |
convert(double value,
TimeUnit srcUnit,
TimeUnit dstUnit)
Converts value expressed in time unit srcUnit to
a time duration expressed in dstUnit and returns
the result of the conversion.
|
double |
getHours()
Returns this time unit represented in hours.
|
java.lang.String |
getLongName()
Returns the long name of this time unit.
|
java.lang.String |
getShortName()
Returns the short name representing this unit in
a string specifying a time duration.
|
java.lang.String |
toString()
Calls
getLongName. |
static TimeUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static TimeUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TimeUnit NANOSECOND
public static final TimeUnit MICROSECOND
public static final TimeUnit MILLISECOND
public static final TimeUnit SECOND
public static final TimeUnit MINUTE
public static final TimeUnit HOUR
public static final TimeUnit DAY
public static final TimeUnit WEEK
public static TimeUnit[] values()
for (TimeUnit c : TimeUnit.values()) System.out.println(c);
public static TimeUnit valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant
with the specified namejava.lang.NullPointerException - if the argument is nullpublic java.lang.String getShortName()
public java.lang.String getLongName()
public java.lang.String toString()
getLongName.toString in class java.lang.Enum<TimeUnit>getLongName.public double getHours()
public static double convert(double value,
TimeUnit srcUnit,
TimeUnit dstUnit)
value - the value being converted.srcUnit - the source time unit.dstUnit - the destination time unit.java.lang.NullPointerException - if srcUnit or
dstUnit are null.To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.