Skip to content

Bacra/node-time-key

Repository files navigation

time-key

NPM Version NPM Downloads Build Status Coveralls NPM License

Time Key

Install

npm install time-key --save

Useage

var timekey = require('time-key');
var timestamp = require('time-stamp');
var key = timekey('YYYYMMDDHH');
console.log(key.key());		// 2016061112
console.log(timestamp('YYYY/MM/DD HH:mm:ss:ms', new Date(key.ttl)));	// 2016/06/11 13:00:00:00

// after 1 hour
console.log(key.key());		// 2016061113
console.log(timestamp('YYYY/MM/DD HH:mm:ss:ms', new Date(key.ttl)));	// 2016/06/11 14:00:00:00