how to add 30 days to a date in javascript




<script>
function today(x){
y=parseInt(x);
var d1=new Date((new Date()).getTime() + y*24*60*60*1000) ;
var rr = d1.toString('yyyy-MM-dd');
a=rr.split(' ');
d=a[2]+'-'+a[1]+'-'+a[3];
//return d ;
alert(d);
}
</script>

<input type="button" onclick="return today(0);" value="Today date"  />

<input type="button" onclick="return today(25);" value="NEXT 25 Days Date"  />


date picker in jquery  



$( ".txtdate" ).datepicker({
changeMonth: true,
changeYear: true
});
$( ".txtdate" ).datepicker( "option", "dateFormat", "dd-M-yy");
        $( ".txtdate" ).val(today('0'));




1. download necessary file from jquery 
2. call txtdate class in input box

Comments

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress