ASP Is Fun

Learning ASP
Free Course
Basics
Functions
SQL Commands
Sample Code

Servers / Setup
Host Reviews
Server Setup
Error Tips

Contract ASP
Development

Intro to ASP



 
Irish Romance


DateAdd Date Function



The DateAdd functon lets you add a certain amount of time to any date. You can determine what will be a week from now, what was 3 days ago, or any other difference.

The format of the DateAdd function is

DateAdd(code, count, date)

Code comes from the table below and indicates what unit of time you are adding to your initial date:

CodeTime Span
yyyyYear
qQuarter
mMonth
yDay of year
dDay
wWeekday
wwWeek of year
hHour
nMinute
sSecond


Count is the number of those units you will be adding - 3 days, 4 hours, 1 month. This can be negative if you want to go backwards in time.

Date is the starting date you wish to begin with.

So to take today's date and figure out what the date was one month ago, you would use

DateAdd("m", -1, Now())

ASP Date and Time Functions


ASP Main Page | ASP Ebooks | Free ASP Course | Contact Lisa
All content copyright © 2008 Minerva WebWorks LLC. All rights reserved.

Irish Wedding


Free Newsletter!

Ebooks
Intro to ASP
ASP SQL DB
Members
Shopping


Introduction to ASP

Romance Tips
Irish Romance
Italian Romance
French Romance

ASP Poll
How do you handle 500 errors?
I don't
Page does nothing
Displays error
Emails error