Answers for "js get difference between two dates in minutes"

3

showing difference between dates in minutes js

const today = new Date();
const endDate = new Date(startDate.setDate(startDate.getDate() + 7));
const days = parseInt((endDate - today) / (1000 * 60 * 60 * 24));
const hours = parseInt(Math.abs(endDate - today) / (1000 * 60 * 60) % 24);
const minutes = parseInt(Math.abs(endDate.getTime() - today.getTime()) / (1000 * 60) % 60);
const seconds = parseInt(Math.abs(endDate.getTime() - today.getTime()) / (1000) % 60);
Posted by: Guest on November-06-2020
0

javascript subtract 2 dates get difference in minutes

var diff = Math.abs(new Date('2011/10/09 12:00') - new Date('2011/10/09 00:00'));
Posted by: Guest on March-01-2021
0

get the difference between two dates js

const date1 = new Date('7/13/2010');
const date2 = new Date('12/15/2010');
const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); 
console.log(diffTime + " milliseconds");
console.log(diffDays + " days");
Posted by: Guest on November-13-2020

Code answers related to "js get difference between two dates in minutes"

Code answers related to "Javascript"

Browse Popular Code Answers by Language