Overview
A class that defines a duration of time. Duration instances are defined in
milliseconds, but can be easily created using time literals; for
example, a two-and-a-half minute Duration instance can be defined in several
ways:
Duration t = 2m + 30s;
Duration t = 2.5m;
Duration t = 2500ms;
Attribute Summary
name | type | description |
---|---|---|
Public | ||
millis | Number |
The duration of time, as expressed in milliseconds. |
Protected |
Inherited Attributes
Function Summary
- public add(other: Duration, ) : Duration
-
Add this instance and another Duration instance to return a new Duration instance.
- public compareTo(obj: Object, ) : Integer
- public div(n: Number, ) : Duration
-
Divide this instance by a number to return a new Duration instance.
- public equals(obj: Object, ) : Boolean
- public ge(other: Duration, ) : Boolean
- public gt(other: Duration, ) : Boolean
- public hashCode() : Integer
- public le(other: Duration, ) : Boolean
- public lt(other: Duration, ) : Boolean
- public mul(n: Number, ) : Duration
-
Multiply this instance with a number to return a new Duration instance.
- public negate() : Duration
- public sub(other: Duration, ) : Duration
-
Subtract this instance from another Duration instance to return a new Duration instance.
- public toDate() : Date
- public toHours() : Number
-
Returns the number of whole hours in this period.
- public toMillis() : Number
-
Returns the number of milliseconds in this period.
- public toMinutes() : Number
-
Returns the number of whole minutes in this period.
- public toSeconds() : Number
-
Returns the number of whole seconds in this period.
- public toString() : String
Inherited Functions
Attributes
public millis: Number
The duration of time, as expressed in milliseconds.
Functions
public add(other: Duration, ):Duration
-
Parameters
- other
-
Returns
- Duration
Add this instance and another Duration instance to return a new Duration instance. This function does not change the value of called Duration instance.
public div(n: Number, ):Duration
-
Parameters
- n
-
Returns
- Duration
Divide this instance by a number to return a new Duration instance. This function does not change the value of called Duration instance.
public hashCode():Integer
-
Returns
- Integer
public mul(n: Number, ):Duration
-
Parameters
- n
-
Returns
- Duration
Multiply this instance with a number to return a new Duration instance. This function does not change the value of called Duration instance.
public negate():Duration
-
Returns
- Duration
public sub(other: Duration, ):Duration
-
Parameters
- other
-
Returns
- Duration
Subtract this instance from another Duration instance to return a new Duration instance. This function does not change the value of called Duration instance.
public toDate():Date
-
Returns
- Date
public toString():String
-
Returns
- String