Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript date increment

Tags:

javascript

I want to set a text box with a date (in dd/mm/yyyy format) 14 days ahead to current date in javascript . can any one help me regarding this ?

like image 418
Muahmmad nadeem Avatar asked Feb 15 '26 14:02

Muahmmad nadeem


1 Answers

This should do it:

var myDate=new Date();
myDate.setDate(myDate.getDate()+14);

then

document.getElementById(YOUR_TEXTBOX_ID).value = myDate.getDate() + "/" + 
  (myDate.getMonth() + 1) + "/" + myDate.getFullYear();
like image 149
kemiller2002 Avatar answered Feb 18 '26 03:02

kemiller2002



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!