<script>
var dtfrm ='10/01/2019';//////////dd/mm/yyyy
var dtto = '31/03/2019';
var d1 = dtfrm.split('/');
var d2 = dtto.split('/');
var frstdate = new
Date(d1[2], (parseFloat(d1[1]) - 1).toFixed(0), d1[0]);
var secdate = new
Date(d2[2], (parseFloat(d2[1]) - 1).toFixed(0), d2[0]);
if (frstdate > secdate) {
var dtothr;
dtothr = frstdate;
frstdate = secdate;
secdate = dtothr;
}
var mnth = ((secdate.getFullYear() * 12 + secdate.getMonth()) -
(frstdate.getFullYear() * 12 + frstdate.getMonth()));
alert(mnth);
</script>
Result///
No comments:
Post a Comment