How does js calculate how many minutes have elapsed from one time to another?

how does js calculate how many minutes have elapsed from one time to another

for example,

  var maxtime ="2018-07-04 13:42:00";
  var mintime = "2018-07-04 00:00:00";

how many minutes are there between maxtime and mintime?

Mar.23,2021

two ways of thinking:
1 counts as a difference of several hours, minutes and seconds
2: all convert to s and then subtract.

the actual development of the project is recommended to adopt moment.js

< hr >

it's not easy to answer. Remember to adopt

if you think it's useful.
var maxtime ="2018-07-04 13:42:00";
var mintime = "2018-07-04 00:00:00";
// 
var b = Date.parse(mintime);
var e = Date.parse(maxtime);
// 
var minutes = Math.round((e - b) / 60 / 1000);

//
var ms = new Date(maxtime).getTime()-new Date(mintime).getTime()
//
var minute = ms/1000/60

//DATE()100060000

var d1 = new Date('2016/03/28 10:17:22');
var d2 = new Date('2016/03/28 11:17:22');
console.log(parseInt(d2 - d1));//
console.log(parseInt(d2 - d1) / 1000);//
console.log(parseInt(d2 - d1) / 6000 );//
console.log(parseInt(d2 - d1) / 3600000 );//
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e663b9-4df2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e663b9-4df2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?