public class Duration extends Object implements Serializable
| Constructor and Description |
|---|
Duration()
Creates a new Duration object with 0 length.
|
Duration(int hours,
int minutes,
float seconds)
Creates a new duration object with the given hours, minutes and seconds
|
Duration(long milliseconds)
Creates a new instance of Duration specifying a length in milliseconds
|
Duration(String duration)
Creates a new Duration parsing the String value.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getMilliseconds()
Returns the millisecond length
|
void |
setMilliseconds(long milliseconds)
Sets the millisecond length
|
String |
toString()
Returns a String representation in the formation HH:MM:SS
|
public Duration()
public Duration(long milliseconds)
milliseconds - Creates a new instance of Duration specifying a length in millisecondspublic Duration(int hours,
int minutes,
float seconds)
hours - number of hoursminutes - number of minutesseconds - number of secondspublic Duration(String duration)
duration - A String to parsepublic String toString()
public long getMilliseconds()
public void setMilliseconds(long milliseconds)
milliseconds - the millisecond lengthCopyright © 2021. All rights reserved.