TimeSpan

Represents a time interval

Constructor
TimeSpan(timeSpan: TimeSpan)

Construct a TimeSpan object from another TimeSpan object

Parameters
timeSpan another TimeSpan to copy values from

TimeSpan(millis: number = 0)

Construct a TimeSpan object to the specified millis

Parameters
millis The millisecond component

TimeSpan(second: number = 0, millis: number = 0)

Construct a TimeSpan object to the specified second, millis

Parameters
second The second component
millis The millisecond component

TimeSpan(minute: number = 0, second: number = 0, millis: number = 0)

Construct a TimeSpan object to the specified minute, second, millis

Parameters
minute The minute component
second The second component
millis The millisecond component

TimeSpan(hour: number = 0, minute: number = 0, second: number = 0, millis: number = 0)

Construct a TimeSpan object to the specified hour, minute, second, millis

Parameters
hour The hour component
minute The minute component
second The second component
millis The millisecond component

TimeSpan(day: number = 0, hour: number = 0, minute: number = 0, second: number = 0, millis: number = 0)

Construct a TimeSpan object to the specified day, hour, minute, second, millis

Parameters
day The day component
hour The hour component
minute The minute component
second The second component
millis The millisecond component
Static Methods
fromDays
static TimeSpan fromDays(days: number)

Returns a TimeSpan that represents a specified number of days

Parameters
days A number of days
Return
TimeSpan The TimeSpan
fromHours
static TimeSpan fromHours(hours: number)

Returns a TimeSpan that represents a specified number of hours

Parameters
hours A number of hours
Return
TimeSpan The TimeSpan
fromMinutes
static TimeSpan fromMinutes(minutes: number)

Returns a TimeSpan that represents a specified number of minutes

Parameters
minutes A number of minutes
Return
TimeSpan The TimeSpan
fromSeconds
static TimeSpan fromSeconds(seconds: number)

Returns a TimeSpan that represents a specified number of seconds

Parameters
seconds A number of seconds
Return
TimeSpan The TimeSpan
Methods
days
number days()

Gets the day component of this instance

Return
number The day component
hours
number hours()

Gets the hour component of this instance

Return
number The hour component
minutes
number minutes()

Gets the minute component of this instance

Return
number The minute component
seconds
number seconds()

Gets the second component of this instance

Return
number The second component
millis
number millis()

Gets the millisecond component of this instance

Return
number The millisecond component
totalDays
number totalDays()

Return the total number of days in this TimeSpan

Return
number Total number of days
totalHours
number totalHours()

Return the total number of hours in this TimeSpan

Return
number Total number of hours
totalMinutes
number totalMinutes()

Return the total number of minutes in this TimeSpan

Return
number Total number of minutes
totalSeconds
number totalSeconds()

Return the total number of seconds in this TimeSpan

Return
number Total number of seconds
totalMillis
number totalMillis()

Return the total number of milliseconds in this TimeSpan

Return
number Total number of milliseconds
isNegative
number isNegative()

Return true if this TimeSpan is negative

Return
number true if this TimeSpan is negative
isZero
number isZero()

Return true if this TimeSpan is 0

Return
number true if this TimeSpan is 0
add
TimeSpan add(timeSpan: TimeSpan)

Returns a copy of this TimeSpan with the specified timespan added

Parameters
timeSpan The timespan to add to this one
Return
TimeSpan A copy of this TimeSpan with the timespan added
addDays
TimeSpan addDays(days: number)

Returns a copy of this TimeSpan plus the specified number of days

Parameters
days The amount of days to add, may be negative
Return
TimeSpan The new TimeSpan plus the increased days
addHours
TimeSpan addHours(hours: number)

Returns a copy of this TimeSpan plus the specified number of hours

Parameters
hours The amount of hours to add, may be negative
Return
TimeSpan The new TimeSpan plus the increased hours
addMinutes
TimeSpan addMinutes(minutes: number)

Returns a copy of this TimeSpan plus the specified number of minutes

Parameters
minutes The amount of minutes to add, may be negative
Return
TimeSpan The new TimeSpan plus the increased minutes
addSeconds
TimeSpan addSeconds(seconds: number)

Returns a copy of this TimeSpan plus the specified number of seconds

Parameters
seconds The amount of seconds to add, may be negative
Return
TimeSpan The new TimeSpan plus the increased seconds
addMillis
TimeSpan addMillis(milliseconds: number)

Returns a copy of this TimeSpan plus the specified number of milliseconds

Parameters
milliseconds The amount of milliseconds to add, may be negative
Return
TimeSpan The new TimeSpan plus the increased milliseconds
sub
TimeSpan sub(timeSpan: TimeSpan)

Returns a copy of this TimeSpan with the specified timespan subtracted

Parameters
timeSpan The TimeSpan to subtract to this one
Return
TimeSpan A copy of this TimeSpan with the timespan subtracted
mul
TimeSpan mul(multiplicand: TimeSpan)

Returns a new TimeSpan with this length multiplied by the specified multiplicand

Parameters
multiplicand the multiplicand to multiply this one by
Return
TimeSpan A new TimeSpan with this length multiplied by the specified multiplicand
div
TimeSpan div(divisor: TimeSpan)

Returns a new TimeSpan with this length divided by the specified divisor

Parameters
divisor the divisor to divide this one by
Return
TimeSpan A new TimeSpan with this length divided by the specified divisor
format
string format(pattern: string)

Output the instant using the specified format pattern

Parameters
pattern The pattern specification, null means use (dd.hh:mm:ss)
Return
string The formatted string, not null

© 2024 - Macrorify by KoK-CODE