Click to See Complete Forum and Search --> : Date Problems
acfstacey
12-08-2003, 08:05 AM
Hi all,
I was just wondering if anyone knew how to work out the date in the future from the current day. I am looking to create a drop down menu that will enable the user to select a date from today to a date 40 days away. I thought about adding 1 to the date in a loop like you can do in Excel, but that just doesn't work. Can anyone help at all. Thanks in advance for your help.
Cheers
Adam
ray326
12-08-2003, 08:44 AM
http://www.w3schools.com/js/js_datetime.asp
acfstacey
12-08-2003, 09:00 AM
I've already viewed that web site, which is very good, but only tells me how to retrieve the date not a date a couple of days away. Does anyone know the answer?
Thanks
Adam
acfstacey
12-08-2003, 09:46 AM
I've already viewed that web site, which is very good, but only tells me how to retrieve the date not a date a couple of days away. Does anyone know the answer?
Thanks
Adam
ray326
12-08-2003, 11:00 AM
Here's the hint.
new Date()
getTime()
new Date(milliseconds)
acfstacey
12-09-2003, 02:33 AM
Sorry, I'm a bit of a newbie and I'm not really sure how your hint works. Has it got something to do with adding 24 hours to the date or something and setting it?
Thanks
Adam
ray326
12-09-2003, 08:53 PM
Originally posted by acfstacey
Sorry, I'm a bit of a newbie and I'm not really sure how your hint works. Has it got something to do with adding 24 hours to the date or something and setting it?
Thanks
Adam
Yes, 24 hours in milliseconds.
1 day = 24x60x60x1000 = 86400000 ms
acfstacey
12-13-2003, 09:15 AM
Sorry for the late reply - have been away. Many thanks for the help. That has sorted me out a treat.
Regards
Ads