how to get the days of 2,3,4 months in javascript -
i want days of more 1 month if pass 2 , 3 ,4 number of month function, want total number of days today
function get_days_in_month(months){ days_in_month = new date(); var y = days_in_month.getfullyear(); var m = days_in_month.getmonth(); if(months==1){ return new date(y,m+1,0).getdate(); } if(months==2){ // need write code or other logic } }
thanks in advance
use for
loop:
var total = 0; (i = 1; <= months; i++) { total += new date(y, m + i, 0).getdate(); } return total;
Comments
Post a Comment