Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TimeSpan

Represents a time interval.

Hierarchy

  • TimeSpan

Index

Constructors

constructor

  • new TimeSpan(ticks: number): TimeSpan
  • new TimeSpan(hours: number, minutes: number, seconds: number): TimeSpan
  • new TimeSpan(days: number, hours: number, minutes: number, seconds: number): TimeSpan
  • Initializes a new instance of the TimeSpan to the specified number of ticks

    Parameters

    • ticks: number

      A time period expressed in 100-nanosecond units.

    Returns TimeSpan

  • Initializes a new instance of the TimeSpan to a specified number of hours, minutes, and seconds.

    Parameters

    • hours: number

      Number of hours.

    • minutes: number

      Number of minutes.

    • seconds: number

      Number of seconds.

    Returns TimeSpan

  • Initializes a new instance of the TimeSpan to a specified number of days, hours, minutes, and seconds.

    Parameters

    • days: number

      Number of days.

    • hours: number

      Number of hours.

    • minutes: number

      Number of minutes.

    • seconds: number

      Number of seconds.

    Returns TimeSpan

Properties

Static MaxMilliSeconds

MaxMilliSeconds: number = Number.MAX_VALUE / TimeSpan.TicksPerMillisecond

Static MaxSeconds

MaxSeconds: number = Number.MAX_SAFE_INTEGER / TimeSpan.TicksPerSecond

Static MaxValue

MaxValue: TimeSpan = new TimeSpan(Number.MAX_VALUE)

Static MinMilliSeconds

MinMilliSeconds: number = Number.MIN_VALUE / TimeSpan.TicksPerMillisecond

Static MinSeconds

MinSeconds: number = Number.MIN_SAFE_INTEGER / TimeSpan.TicksPerSecond

Static MinValue

MinValue: TimeSpan = new TimeSpan(Number.MIN_VALUE)

Static TicksPerDay

TicksPerDay: number = TimeSpan.TicksPerHour * 24

Static TicksPerHour

TicksPerHour: number = TimeSpan.TicksPerMinute * 60

Static TicksPerMillisecond

TicksPerMillisecond: 10000 = 10000

Static TicksPerMinute

TicksPerMinute: number = TimeSpan.TicksPerSecond * 60

Static TicksPerSecond

TicksPerSecond: number = TimeSpan.TicksPerMillisecond * 1000

Static TicksPerTenthSecond

TicksPerTenthSecond: number = TimeSpan.TicksPerMillisecond * 100

Static Zero

Zero: TimeSpan = new TimeSpan(0)

Accessors

days

  • get days(): number
  • Gets the days component of the time interval represented by the current TimeSpan structure.

    Returns number

hours

  • get hours(): number
  • Gets the hours component of the time interval represented by the current TimeSpan structure.

    Returns number

milliseconds

  • get milliseconds(): number
  • Gets the milliseconds component of the time interval represented by the current TimeSpan structure.

    Returns number

minutes

  • get minutes(): number
  • Gets the minutes component of the time interval represented by the current TimeSpan structure.

    Returns number

seconds

  • get seconds(): number
  • Gets the seconds component of the time interval represented by the current TimeSpan structure.

    Returns number

ticks

  • get ticks(): number
  • Gets the number of ticks that represent the value of he current TimeSpan.

    Returns number

totalDays

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

    Returns number

totalHours

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

    Returns number

totalMilliseconds

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

    Returns number

totalMinutes

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

    Returns number

totalSeconds

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

    Returns number

Methods

add

  • Add two TimeSpans.

    Parameters

    • ts: TimeSpan

      TimeSpan to add to current instance

    Returns TimeSpan

    A new TimeSpan whose value is the sum of the specified TimeSpan and this instance

compareTo

  • Compares this instance to a specified TimeSpan and returns an integer that indicates whether this instance is shorter than, equal to, or longer than the specified object or TimeSpan object.

    Parameters

    Returns number

    A signed number indicating the relative values of this instance -1 This instance is shorter than 1 This instance is greater than 0 This instance is equal to.

duration

  • Get the current Timespan represent a duration of time. (Absolute value)

    Returns TimeSpan

    A new TimeSpan whose value is the absolute value of the current TimeSpan.

equals

  • Check if two Timespans are equal

    Parameters

    • ts: TimeSpan

      An TimeSpan to compare with this instance.

    Returns boolean

    true if TimeSpan represents the same time interval as this instance; otherwise false

substract

  • Subtracts two TimeSpans.

    Parameters

    • ts: TimeSpan

      TimeSpan to subtract from the current instance

    Returns TimeSpan

    A new TimeSpan whose value is the difference between the specified TimeSpan and this instance.

Static TimeToTicks

  • TimeToTicks(hour: number, minute: number, second: number): number
  • Parameters

    • hour: number
    • minute: number
    • second: number

    Returns number

Generated using TypeDoc