Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TimeSpan

Represents a time interval, similar to the .Net TimeSpan

Hierarchy

  • TimeSpan

Index

Constructors

constructor

  • new TimeSpan(milliseconds: number, seconds?: number | string, minutes?: number | string, hours?: number | string, days?: number | string): TimeSpan
  • Constructs a new TimeSpan object whose value is the sum of the specified components.

    Parameters

    • milliseconds: number
    • Optional seconds: number | string
    • Optional minutes: number | string
    • Optional hours: number | string
    • Optional days: number | string

    Returns TimeSpan

Properties

ticks

ticks: number

Accessors

days

  • get days(): number
  • Gets the days component of the time interval

    Returns number

hours

  • get hours(): number
  • Gets the hours component of the time interval

    Returns number

milliseconds

  • get milliseconds(): number
  • Gets the milliseconds component of the time interval

    Returns number

minutes

  • get minutes(): number
  • Gets the minutes component of the time interval

    Returns number

seconds

  • get seconds(): number
  • Gets the seconds component of the time interval

    Returns number

totalDays

  • get totalDays(): number
  • Gets the value of the current TimeSpan expressed in whole and fractional days.

    Returns number

totalHours

  • get totalHours(): number
  • Gets the value of the current TimeSpan expressed in whole and fractional hours.

    Returns number

totalMilliseconds

  • get totalMilliseconds(): number
  • Gets the value of the current TimeSpan expressed in whole and fractional milliseconds.

    Returns number

totalMinutes

  • get totalMinutes(): number
  • Gets the value of the current TimeSpan expressed in whole and fractional minutes.

    Returns number

totalSeconds

  • get totalSeconds(): number
  • Gets the value of the current TimeSpan expressed in whole and fractional seconds.

    Returns number

Methods

abs

  • Returns a TimeSpan whose value is the absolute value of the specified instance.

    Returns TimeSpan

add

  • Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.

    Parameters

    Returns TimeSpan

dividedBy

  • Returns a new TimeSpan object which value is the result of division of this instance and the specified divisor.

    Parameters

    • divisor: number

    Returns TimeSpan

equals

  • Returns a value indicating whether two instances of TimeSpan are equal.

    Parameters

    Returns boolean

multipliedWith

  • multipliedWith(factor: number): TimeSpan
  • Returns a new TimeSpan object which value is the result of multiplication of this instance and the specified factor.

    Parameters

    • factor: number

    Returns TimeSpan

negate

  • Returns a TimeSpan whose value is the negated value of the specified instance.

    Returns TimeSpan

subtract

  • Returns a new TimeSpan object whose value is the difference of the specified TimeSpan object and this instance.

    Parameters

    Returns TimeSpan

toString

  • toString(): string
  • Returns the string representation of the TimeSpan object.

    Returns string

valueOf

  • valueOf(): number
  • Gets the value of the current TimeSpan expressed in whole and fractional milliseconds.

    Returns number

Static FromDates

  • FromDates(firstDate: Date | number | string, secondDate: Date | number | string): TimeSpan
  • Returns the difference of two dates as a new TimeSpan.

    Parameters

    • firstDate: Date | number | string
    • secondDate: Date | number | string

    Returns TimeSpan

    the TimeSpan

Static FromDays

  • FromDays(days: string | number): TimeSpan
  • Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.

    Parameters

    • days: string | number

    Returns TimeSpan

Static FromHours

  • FromHours(hours: string | number): TimeSpan
  • Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.

    Parameters

    • hours: string | number

    Returns TimeSpan

Static FromMinutes

  • FromMinutes(minutes: string | number): TimeSpan
  • Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.

    Parameters

    • minutes: string | number

    Returns TimeSpan

Static FromSeconds

  • FromSeconds(seconds: string | number): TimeSpan
  • Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.

    Parameters

    • seconds: string | number

    Returns TimeSpan

Static Parse

  • Parses the specified value into a TimeSpan.

    Parameters

    • value: string | TimeSpan | number | undefined

      The value to parse

    Returns TimeSpan

    the TimeSpan, or a zero TimeSpan if the value can't be parsed.

Static ParseExact

  • ParseExact(value: string | TimeSpan | number | undefined): TimeSpan | undefined
  • Parses the specified value into a TimeSpan.

    Parameters

    • value: string | TimeSpan | number | undefined

      The value to parse

    Returns TimeSpan | undefined

    the TimeSpan, or undefined if the value can't be parsed.

Static Private getDays

  • getDays(ticks: number): number

Static Private getHours

  • getHours(ticks: number): number

Static Private getMinutes

  • getMinutes(ticks: number): number

Static Private getSeconds

  • getSeconds(ticks: number): number

Generated using TypeDoc