I have this script,
var today = new Date();
var dd = today.getDate();
var ffffd = today.getDate()-1;
var ffffdd = today.getDate()-2;
var mm = today.getMonth()+
var firstDay = new Date();
var secondDay = new Date();
var thirdDay = new Date();
//Now say you want to set secondDay as before 2 days
secondDay.setDate(secondDay.getDate()-2);
//Now say you want to set thirdDay as after 2 days
thirdDay.setDate(thirdDay.getDate()+2);
alert("firstDay: "+firstDay+", secondDay:"+secondDay+", thirdDay:"+thirdDay);
alert("date of thirdDay: dd/mm/yyyy "+thirdDay.getDate()+"/"+ (thirdDay.getMonth()+1) +"/"+thirdDay.getFullYear());