It is often necessary to add or subtract values from dates. Here are a few examples of how to do it:
Adding to Dates
<%
Response.Write DateAdd ("m", 1, #4/17/01#)
%>
This adds one month to the date 4/17/01: 17/05/2001
<%
Response.Write DateAdd ("d", 1, Date)
%>
This displays tomorrows date like this: 01/12/2011
Subtracting from Dates
<%
Response.Write DateAdd ("d", -1, Date)
%>
This displays yesterdays date like this: 29/11/2011
http://www.aspwebpro.com/aspscripts/dates/addsubtractdate.asp
No comments:
Post a Comment