C

TimeSpan

A structure which represents a time span.
ImplementsInheritance Hierarchy

Remarks

This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.

There are some string formats that are converted to TimeSpan. For example:

'1s'
'0.5m'
'1h'
'1h 20m'
'1:20'
'1:20:30.5'

It is also possible to use a which will be interpreted in milliseconds.

See Also

Developer's Guide

Members

No filters for this type

Constructors

Creates a new time span which is ticks milliseconds long.

Parameters

ticks: number
The length of the time span in milliseconds.
Creates a new time span with a given length.

Parameters

days: number
The days part of the time span.
hours: number
The hour part of the time span.
minutes: number
The minute part of the time span.
seconds: number
The seconds part of the time span.
millis: number
The milliseconds part of the time span.

Properties

The total milliseconds (ticks) of this time span.
readonlyfinal
The total seconds of this time span.
readonlyfinal
The total seconds of this time span.
readonlyfinal

Methods

Compares this object to the given object of the same type.
final

Parameters

obj: any
The object to compare this to.

Return Value

number
  • -1: this is less than obj
  • 0: this is equal to obj
  • 1: this is greater than obj
Determines whether another object is equal to this one.
final

Parameters

obj: any
the other object to compare for equality

Return Value

boolean
true if obj is considered equal to this instance.
Returns a hash code for this object.

The hash code is a numeric value that can be used to treat this object as a key in a hash table or similar data structure.

Two objects that are considered equal must have the same hash code. However, the reverse does not hold and two objects having the same hash code don't have to be equal. Ideally, the hash code should be roughly uniformly-distributed to prevent hash tables from performing poorly. Calculating the hash code is also a potentially frequent operation and should therefore be fast.

final

Return Value

number
the hash code for this object
Returns a string representation for this object.
final

Return Value

string
a string describing this object

Constants

A timespan with duration Number.MAX_SAFE_INTEGER.
A timespan with duration zero.

Static Methods

Creates a TimeSpan instance from the given object by performing automatic type conversion.
static

Parameters

timeSpanLike: TimeSpan
The object to convert to a TimeSpan.

Return Value

TimeSpan
Either timeSpanLike if it is already a TimeSpan or a new instance, initialized to the values found in timeSpanLike.
Creates a new time span with the given length in milliseconds.
static

Parameters

milliseconds: number
The length of the time span in milliseconds.

Return Value

TimeSpan
A newly created time span.
Creates a new time span with the given length in minutes.
static

Parameters

minutes: number
The length of the time span in minutes.

Return Value

TimeSpan
A newly created time span.
Creates a new time span with the given length in seconds.
static

Parameters

seconds: number
The length of the time span in seconds.

Return Value

TimeSpan
A newly created time span.