eWebProgrammer eweb





ASP   «Prev 

DateAdd function example

ASP Date Function

ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and XML web services.
It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology.


Elements of the ASP script
Elements of the ASP script

Create and initialize the two variables
Create and initialize the two variables, dCurrDate and dNextMonth, that we need to perform the calculation.


Use the Date() function for current date to set the value of variable dCurrDate
Use the Date() function for current date to set the value of variable dCurrDate to today's date.

Use the DateAdd function with its parameter set to days
Use the DateAdd function with its parameter set to days, +30 and today's date to count 30 days past today and place the result in our other variable, dNextMonth. Note that the result date may or may not be in the same month as today's date.

Display the new date, 30 days in the future to the user
Display the new date, 30 days in the future to the user