View Single Post
Old 2007-09-21, 09:52 PM   #2
Llam4
A woman is like beer. They look good, they smell good, and you'd step over your own mother just to get one!
 
Join Date: Sep 2007
Location: Arizona
Posts: 52
Send a message via AIM to Llam4
now.get<b>unit</b> returns a number. 1-31 for day, 1-12 for months. Just use those variable instead of the clunky now.getDate() and add or subtract directly.

For example:

If you want to show one year ahead, 2 months behind and 8 days ahead, you'd change
Code:
document.write("Today is " + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " "+now.getDate() +".")
to
Code:
document.write("Today is " + dayName[now.getDay()+8] + ", " + monName[now.getMonth()-2] + " " + now.getDay()+8 + ", " + now.getYear()+1 +".")
Llam4 is offline   Reply With Quote