I've also tried another method of grabbing the entire date string and turning it into an array but that causes and error and I dont know why.
Err I'm well confused
Code:
var myDate=new Date()
myDate.setDate(myDate.getDate()+5)
var testStr = myDate;
testStr = testStr.split(' ');
document.write("<br/>");
var arrayIndex;
for (arrayIndex in testStr)
{
document.write(testStr[arrayIndex] + "<br/>");
}
When you get a date from a Date object you get an integer,
it no longer 'knows' anything about the date object except
for the number of the date.
To add a day to a date and return a new date you need
to increment the object and then read the new value:
I work with dates enough to make adding (or subtracting)
days and parts of days a method for all Dates, though you can use the same
code in a function call:
Code:
Date.prototype.addpartDay= function(n){
if(!n) n= 1;
n*=(86400000);
var d= (this.getTime()+n);
return new Date(d);
};
I've kinda worked out a work around solution but it doesn't work?
Code:
var myDate=new Date()
myDate.setDate(myDate.getDate()+5)
var testStr = myDate;
testStr = testStr.split(' ');
document.write("<br/>");
var arrayIndex;
for (arrayIndex in testStr)
{
document.write(testStr[arrayIndex] + "<br/>");
}
var myDate=new Date()
myDate.setDate(myDate.getDate()+5)
Is the correct way to add five days to the current date. If you try adding ticks you'll run afoul of Daylight Savings Time.
You don't need to be playing around with the string version of the date unless you are up to something strange. What exactly are you up to?
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
You want to use the various methods of the Date object to populate the form. Methods like Date.getMonth and Date.getFullYear.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
As I mentioned above, in some parts of the world that will go awry twice a year.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Bookmarks