function displayDate()
{
var d1 = new Date( "1989-11-30"); var d2 = new Date(); var Months = d2.getMonth() - d1.getMonth();
var Years = d2.getFullYear() - d1.getFullYear();
var Days = d2.getDate() - d1.getDate();
Months=(d2.getMonth()+12*d2.getFullYear())-(d1.getMonth()+12* d1.getFullYear());
var MonthOverflow = 0;
if(Months - (Years*12) < 0)
MonthOverFlow = -1;
else
MonthOverFlow = 1;
if( MonthOverFlow<0 )
Years= Years - 1;
Months= Months-(Years*12);
var LastDayOfMonth = new Date(d2.getFullYear(), d2.getMonth() + 1, 0, 23, 59, 59);
LastDayOfMonth= LastDayOfMonth.getDate() ;
if(MonthOverFlow <0 && (d1.getDate() > d2.getDate()))
{
Days= LastDayOfMonth + (d2.getDate() -d1.getDate()) - 1;
}
else
Days= d2.getDate() - d1.getDate();
document.getElementById("demo").innerHTML=Years+" Year(s), " + Months + " Month(s), " + Days + "Day(s)";
}