Home Manual Reference Source Test

Function

Static Public Summary
public

toNanoDate(timestamp: String): INanoDate

Covers a nanoseconds unix timestamp to a INanoDate for node-influx.

Static Public

public toNanoDate(timestamp: String): INanoDate source

import {toNanoDate} from 'influx'

Covers a nanoseconds unix timestamp to a INanoDate for node-influx. The timestamp is provided as a string to prevent precision loss.

Please see A Moment for Times for a more complete and eloquent explanation of time handling in this module.

Params:

NameTypeAttributeDescription
timestamp String

Return:

INanoDate

Example:

const date = toNanoDate('1475985480231035600')

// You can use the returned Date as a normal date:
expect(date.getTime()).to.equal(1475985480231);

// We decorate it with two additional methods to read
// nanosecond-precision results:
expect(date.getNanoTime()).to.equal('1475985480231035600');
expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035600Z');