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 ?
+6
A:
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();
Kevin
2010-04-26 14:24:28
A:
Like Deodeus suggested, use Date.js:
var myDate = Date.today().add(14).days();
document.getElementById('mytextbox').value = myDate.toString('dd/MM/yyyy');
Jakob Kruse
2010-04-26 14:32:41