Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

exact-time

vigreco2MIT0.0.3

Get the exact date and time with ease

time, date, exact, exact time, exact date, current time

readme

exact-time

Promise based lib to get the exact date and time with ease.

Installation

$ npm install --save exact-time

Usage

const exactTime = require('exact-time')

exactTime.getDate()
  .then(date => console.log(date.toString()))

// Thu May 11 2017 12:20:40 GMT+0200 (CEST)

Example

$ node examples/time.js

Exact time:  Thu May 11 2017 12:20:40 GMT+0200 (CEST)
Your system clock is 1 minute and 7 seconds behind.

API

getDate([forceNetSync])

Type: Date
Returns a Date object with the exact time.

getOffset([forceNetSync])

Type: Number
Returns the difference between system time and exact time in seconds.

forceNetSync

Type: Boolean
Forces a new time sync with the server.

License

MIT © Vincenzo Greco