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

Here is an example of getting the future date…

var targetDate = new Date();
targetDate.setDate(targetDate.getDate() + 10);

// So you can see the date we have created
alert(targetDate);

var dd = targetDate.getDate();
var mm = targetDate.getMonth() + 1; // 0 is January, so we must add 1
var yyyy = targetDate.getFullYear();

var dateString = dd + "https://stackoverflow.com/" + mm + "https://stackoverflow.com/" + yyyy;

// So you can see the output
alert(dateString);

There are some more graceful ways to format dates, examples can be found at the following destinations:

http://www.west-wind.com/Weblog/posts/282495.aspx

http://www.svendtofte.com/javascript/javascript-date-string-formatting/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)