Duration | Documentation
Description: Documentation for Documentation

# Interface Duration

A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.

#### Hierarchy

- Number
  - Duration

- Defined in types.d.ts:847
- Defined in types.d.ts:848
- Defined in types.d.ts:857
- Defined in types.d.ts:863
- Defined in types.d.ts:869
- Defined in types.d.ts:875
- Defined in types.d.ts:881
- Defined in types.d.ts:887
- Defined in types.d.ts:893
- Defined in types.d.ts:900
- Defined in types.d.ts:911

#####
Index

### Methods

Abs
Hours
Microseconds
Milliseconds
Minutes
Nanoseconds
Round
Seconds
String
Truncate
toExponential
toFixed
toLocaleString
toPrecision
toString
valueOf

## Methods

### Abs

- Abs(): Duration

- Abs returns the absolute value of d. As a special case, [math.MinInt64] is converted to [math.MaxInt64].

  #### Returns Duration

  - Defined in types.d.ts:916

### Hours

- Hours(): number

- Hours returns the duration as a floating point number of hours.

  #### Returns number

  - Defined in types.d.ts:891

### Microseconds

- Microseconds(): number

- Microseconds returns the duration as an integer microsecond count.

  #### Returns number

  - Defined in types.d.ts:867

### Milliseconds

- Milliseconds(): number

- Milliseconds returns the duration as an integer millisecond count.

  #### Returns number

  - Defined in types.d.ts:873

### Minutes

- Minutes(): number

- Minutes returns the duration as a floating point number of minutes.

  #### Returns number

  - Defined in types.d.ts:885

### Nanoseconds

- Nanoseconds(): number

- Nanoseconds returns the duration as an integer nanosecond count.

  #### Returns number

  - Defined in types.d.ts:861

### Round

- Round(m): Duration

- Round returns the result of rounding d to the nearest multiple of m. The rounding behavior for halfway values is to round away from zero. If the result exceeds the maximum (or minimum) value that can be stored in a [Duration], Round returns the maximum (or minimum) duration. If m <= 0, Round returns d unchanged.

  #### Parameters

  - ##### m: Duration

  #### Returns Duration

  - Defined in types.d.ts:909

### Seconds

- Seconds(): number

- Seconds returns the duration as a floating point number of seconds.

  #### Returns number

  - Defined in types.d.ts:879

### String

- String(): string

- String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.

  #### Returns string

  - Defined in types.d.ts:855

### Truncate

- Truncate(m): Duration

- Truncate returns the result of rounding d toward zero to a multiple of m. If m <= 0, Truncate returns d unchanged.

  #### Parameters

  - ##### m: Duration

  #### Returns Duration

  - Defined in types.d.ts:898

### toExponential

- toExponential(fractionDigits?): string

- Returns a string containing a number represented in exponential notation.

  #### Parameters

  - ##### `Optional` fractionDigits: number

    Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.

  #### Returns string

  Inherited from Number.toExponential

  - Defined in node_modules/typescript/lib/lib.es5.d.ts:576

### toFixed

- toFixed(fractionDigits?): string

- Returns a string representing a number in fixed-point notation.

  #### Parameters

  - ##### `Optional` fractionDigits: number

    Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.

  #### Returns string

  Inherited from Number.toFixed

  - Defined in node_modules/typescript/lib/lib.es5.d.ts:570

### toLocaleString

- toLocaleString(locales?, options?): string

- Converts a number to a string by using the current or specified locale.

  #### Parameters

  - ##### `Optional` locales: string | string[]

    A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.

  - ##### `Optional` options: NumberFormatOptions

    An object that contains one or more properties that specify comparison options.

  #### Returns string

  Inherited from Number.toLocaleString

  - Defined in node_modules/typescript/lib/lib.es5.d.ts:4522

### toPrecision

- toPrecision(precision?): string

- Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.

  #### Parameters

  - ##### `Optional` precision: number

    Number of significant digits. Must be in the range 1 - 21, inclusive.

  #### Returns string

  Inherited from Number.toPrecision

  - Defined in node_modules/typescript/lib/lib.es5.d.ts:582

### toString

- toString(radix?): string

- Returns a string representation of an object.

  #### Parameters

  - ##### `Optional` radix: number

    Specifies a radix for converting numeric values to strings. This value is only used for numbers.

  #### Returns string

  Inherited from Number.toString

  - Defined in node_modules/typescript/lib/lib.es5.d.ts:564

### valueOf

- valueOf(): number

- Returns the primitive value of the specified object.

  #### Returns number

  Inherited from Number.valueOf

  - Defined in node_modules/typescript/lib/lib.es5.d.ts:585

Generated using TypeDoc