Get days between two dates-Java-Script

  1. pass start date and end date whith give format.

var date1 = new Date(“7/13/2010”);
var date2 = new Date(“12/15/2010”);
var timeDiff = Math.abs(date2.getTime() – date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));

diffDays variable will return you days between two dates.

Leave a Reply

Your email address will not be published. Required fields are marked *