Skip to content

Instantly share code, notes, and snippets.

@servatj
Created February 25, 2019 12:16
Show Gist options
  • Save servatj/0e13d8ca59d7523219b181029a69287e to your computer and use it in GitHub Desktop.
Save servatj/0e13d8ca59d7523219b181029a69287e to your computer and use it in GitHub Desktop.
Get the number of days between to days in JS
var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds
var firstDate = new Date(2018,08,13);
var secondDate = new Date(2019,02,25);
var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment