JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

Profile: desktop, common

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;
Duration instances are immutable, and are therefore replaced rather than modified. To create a new Duration instance, either use a time literal, or use the Duration.valueOf(milliseconds) factory method.

Profile: common

Inherited Variables

Function Summary

public add(other: Duration) : Duration

Add this instance and another Duration instance to return a new Duration instance.

Add this instance and another Duration instance to return a new Duration instance. This function does not change the value of called Duration instance.

Parameters
other
Returns
Duration

Profile: common

 
public div(n: Number) : Duration

Divide this instance by a number to return a new Duration instance.

Divide this instance by a number to return a new Duration instance. This function does not change the value of called Duration instance.

Parameters
n
Returns
Duration

Profile: common

 
public ge(other: Duration) : Boolean

Returns true if the specified duration is greater than or equal to (>=) this instance.

Returns true if the specified duration is greater than or equal to (>=) this instance.

Parameters
other
Returns
Boolean

Profile: common

 
public gt(other: Duration) : Boolean

Returns true if the specified duration is greater than (>) this instance.

Returns true if the specified duration is greater than (>) this instance.

Parameters
other
Returns
Boolean

Profile: common

 
public le(other: Duration) : Boolean

Returns true if the specified duration is less than or equal to (<=) this instance.

Returns true if the specified duration is less than or equal to (<=) this instance.

Parameters
other
Returns
Boolean

Profile: common

 
public lt(other: Duration) : Boolean

Returns true if the specified duration is less than (<) this instance.

Returns true if the specified duration is less than (<) this instance.

Parameters
other
Returns
Boolean

Profile: common

 
public mul(n: Number) : Duration

Multiply this instance with a number to return a new Duration instance.

Multiply this instance with a number to return a new Duration instance. This function does not change the value of called Duration instance.

Parameters
n
Returns
Duration

Profile: common

 
public negate() : Duration

Return a new Duration instance which has a negative number of milliseconds from this instance.

Return a new Duration instance which has a negative number of milliseconds from this instance. For example, (50ms).negate() returns a Duration of -50 milliseconds. This function does not change the value of called Duration instance.

Returns
Duration

Profile: common

 
public sub(other: Duration) : Duration

Subtract other Duration instance from this instance to return a new Duration instance.

Subtract other Duration instance from this instance to return a new Duration instance. This function does not change the value of called Duration instance.

Parameters
other
Returns
Duration

Profile: common

 
public toDate() : java.util.Date

Returns a Date instance initialized to the length of this instance.

Returns a Date instance initialized to the length of this instance. It is equivalent to new java.util.Data(this.toMillis()).

Returns
Date
 
public toHours() : Number

Returns the number of whole hours in this period.

Returns the number of whole hours in this period.

Returns
Number

Profile: common

 
public toMillis() : Number

Returns the number of milliseconds in this period.

Returns the number of milliseconds in this period.

Returns
Number

Profile: common

 
public toMinutes() : Number

Returns the number of whole minutes in this period.

Returns the number of whole minutes in this period.

Returns
Number

Profile: common

 
public toSeconds() : Number

Returns the number of whole seconds in this period.

Returns the number of whole seconds in this period.

Returns
Number

Profile: common

 
public valueOf(ms: Number) : Duration

Factory method that returns a Duration instance for a specified number of milliseconds.

Factory method that returns a Duration instance for a specified number of milliseconds.

Parameters
ms
the number of milliseconds
Returns
Duration
a Duration instance of the specified number of milliseconds

Profile: common

 

Inherited Functions