date-timestamp-diff
v1.0.3
Published
It's return time difference between two dates or two timestamp.
Downloads
3
Readme
It's easily to get age between two dates or two timestamp
installation :
npm install date-timestamp-diff --save
Usage :
Node.js
var timeDifference = require('date-timestamp-diff');
Date Convert To Age :
const startDate = "11/23/2017 3:04:25" (or) "11-23-2017 3:04:25" (Month-day-year hour:minute:second)
const endDate = "12/24/2018 4:05:26" (or) "12-24-2018 4:05:26" (Month-day-year hour:minute:second)
---> date must be string and startDate always have less than endDate
const Age = timeDifference.convertDateToAge(startDate, endDate);
console.log("age--",Age);
output : age-- { year: 1,
month: 1,
day: 1,
hour: 1,
minute: 1,
second: 1
}
It's return Object.
Timestamp Convert To Age :
const startTimestamp = "1519110711";
const endTimestamp = "1519210717";
---> timestamp must be string and startTimestamp always have less than endTimestamp.
const Age = timeDifference.convertTimestampToAge(startTimestamp, endTimestamp)
console.log("age--",Age);
output : age--- { day: 1,
hour: 3,
minute: 46,
second: 46
}