///

TimeSpan Class

TimeSpan represents a duration.

TimeSpan.fromMilliseconds(...)

Create a duration.

let span = TimeSpan.fromMilliseconds(1500); console.log(span.toSimpleString());

fromSeconds(...)

Create a duration.

let span = TimeSpan.fromSeconds(5); let result = span.fromSeconds('demo'); console.log(result);

fromMinutes(...)

Create a duration.

let span = TimeSpan.fromSeconds(5); let result = span.fromMinutes('demo'); console.log(result);

fromHours(...)

Create a duration.

let span = TimeSpan.fromSeconds(5); let result = span.fromHours('demo'); console.log(result);

fromDays(...)

Create a duration.

let span = TimeSpan.fromSeconds(5); let result = span.fromDays('demo'); console.log(result);

TimeSpan.zero()

Zero duration.

let span = TimeSpan.zero(); console.log(span.toSimpleString());

getTotalMilliseconds()

Read total values.

let span = TimeSpan.fromSeconds(5); let result = span.getTotalMilliseconds(); console.log(result);

getTotalSeconds()

Read total values.

let span = TimeSpan.fromSeconds(5); let result = span.getTotalSeconds(); console.log(result);

getTotalMinutes()

Read total values.

let span = TimeSpan.fromSeconds(5); let result = span.getTotalMinutes(); console.log(result);

getTotalHours()

Read total values.

let span = TimeSpan.fromSeconds(5); let result = span.getTotalHours(); console.log(result);

getTotalDays()

Read total values.

let span = TimeSpan.fromSeconds(5); let result = span.getTotalDays(); console.log(result);

getDays()

Read component parts.

let span = TimeSpan.fromSeconds(5); let result = span.getDays(); console.log(result);

getHours()

Read component parts.

let span = TimeSpan.fromSeconds(5); let result = span.getHours(); console.log(result);

getMinutes()

Read component parts.

let span = TimeSpan.fromSeconds(5); let result = span.getMinutes(); console.log(result);

getSeconds()

Read component parts.

let span = TimeSpan.fromSeconds(5); let result = span.getSeconds(); console.log(result);

getMilliseconds()

Read component parts.

let span = TimeSpan.fromSeconds(5); let result = span.getMilliseconds(); console.log(result);

add(...)

Duration math.

let extra = TimeSpan.fromSeconds(15); console.log(span.add(extra).toSimpleString());

subtract(...)

Duration math.

let other = TimeSpan.fromSeconds(30); console.log(span.subtract(other).toSimpleString());

multiply(...)

Duration math.

console.log(span.multiply(2).toSimpleString());

divide(...)

Duration math.

console.log(span.divide(2).toSimpleString());

negate()

Duration math.

console.log(span.negate().toSimpleString());

compareTo(...)

Comparison helpers.

let other = TimeSpan.fromSeconds(10); console.log(span.compareTo(other));

equals(...)

Comparison helpers.

let other = TimeSpan.fromSeconds(5); console.log(span.equals(other));

isGreaterThan(...)

Comparison helpers.

let other = TimeSpan.fromSeconds(3); console.log(span.isGreaterThan(other));

isLessThan(...)

Comparison helpers.

let other = TimeSpan.fromSeconds(10); console.log(span.isLessThan(other));

toSimpleString()

Readable output.

console.log(span.toSimpleString());

toString()

Returns a full string representation of the duration.

let span = TimeSpan.fromSeconds(5); let result = span.toString(); console.log(result);