Set date 10 days in the future and format to dd/mm/yyyy (e.g. 21/08/2010)

Viewed 64684

I would really appreciate some help creating some JavaScript that will eventually be used in Selenium that automatically sets a date 10 days ahead from the current date and displays in the following format dd/mm/yyyy.

I currently have the script below, but I'm not getting anywhere with it :

var myDate = new Date();
myDate.now.format(myDate.setDate(myDate.getDate()+5),("dd/mm/yyyy");
6 Answers

I needed to get future year by adding months:

var duration = 13;
var month = 11;
var year = 2018;
var final_year = new Date(year, month + duration);
document.body.innerHTML = final_year.getFullYear();

Related