Newbie here with what's probably a very simple question for you folks but I would greatly appreciate any help.
I'm using a javascript to automatically add 5 days to today's date. It works just fine but it displays the date as "Friday, February 01, 2013" when I would like it displayed as just "February 01" (i.e. without the day of the week or the year).
Here's the script I'm using and thanks in advance for any suggestions!
function addDate(dateObject, numDays) {
dateObject.setDate(dateObject.getDate() + numDays);
return dateObject.toLocaleDateString();
}
var numDays;
var oldDate;
var newDate;
oldDate = new Date();
numDays = 5;
<!-- document.write(""); -->
newDate = addDate(oldDate, numDays)
document.writeln("<small><font color='000000' face='Arial'><b>" + newDate + "</b></font></small>");
Thanks for the response ReFreezed. It sort of worked in that it displayed the result as just the month and date but it did so in an alert box as opposed to on the web page (the document.write thing). Also, it just displayed today's date and not today's date plus 5 days which is what the script is all about.
Bookmarks