I have from date and to date
need to find no days from javascript??
e.g 30-3-2010 to 2-4-2010 like this

Try this code.

var t1 = "10/10/2009" ;
var t2 = "15/10/2009";
var one_day=1000*60*60*24; //Total time for one day

var x=t1.split("/");     
var y=t2.split("/");

var date1=new Date(x[2],(x[1]-1),x[0]); //date format(Fullyear,month,date)   
var date2=new Date(y[2],(y[1]-1),y[0])
var month1=x[1]-1;
var month2=y[1]-1;
               
var _Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day));

Reference: How to calculate difference between two dates using JavaScript

Calculating date differences using JavaScript

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.