How many days have passed to get the current date of 2018 and the current date of 2017?

how to get the current date of 2018 and the current date of 2017 how many days have passed?

the current date is 2018-07-02

how many days have passed since 2017-07-02 to 2018-07-02, and how do you calculate it?

Mar.23,2021

  1. time conversion
  2. get milliseconds of time difference
  3. is converted to the number of days, rounded as needed (rounded, etc.)
var milliSeconds =new Date('2018-07-02').getTime() - new Date('2017-07-02').getTime();
var seconds = milliSeconds/1000 //
var days = seconds / (3600 * 24) 

isn't it 365 dollars? Does this count?
all right

console.log((2018 - 2017) * 365);
Menu