Add & Subtract From Dates

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 so 4/17/01 would become:  5/17/2001

<%
Response.Write DateAdd ("d", 1, Date)
%>

This displays tomorrows date in this format:  5/6/2015

Subtracting from Dates

<%
Response.Write DateAdd ("d", -1, Date)
%>

This displays yesterdays date in this format:  5/4/2015

< Back to ASP Scripts