Click to See Complete Forum and Search --> : DateTime in ASP


wyzarddoc
06-04-2003, 10:37 AM
Hi all;
Using ASP or JavaScript on a win2000 server
I need to get the current date and add 10 days to it then save it in a variable in my access database. Is there a better way than writing a loop and executing x times till I get the right digits?
Thanks
Doc

cmelnick
06-04-2003, 11:20 AM
Yes, there is a better way.


currDate = Now()
nextDate = DateAdd("D", 10, currDate)

Response.Write "Current date is: " & currDate & "<br>" & _
"Next date is: " & nextDate & "<br>"


Then you can store nextDate in your DB in date format.

This is also very useful, because it will automagically wrap months, or years. For example, if it is May 30 and you add 10, you will get June 10.

See http://www.aardwulf.com/tutor/dateaddtest.asp for a working example.

See the Guru (http://www.devguru.com/Technologies/vbscript/quickref/dateadd.html) for a complete description of the DateAdd method.

wyzarddoc
06-04-2003, 12:33 PM
Thanks
It's hard for a old dog to learn new tricks without a little help!!!