This function returns a date value based on adding an interval of time. It will be more clear by going through the following examples.
DateAdd ( interval , number, date )
This is a required argument. This is a string expression which specify the interval type but not the quantity. For example, Minute, second, hour, day etc. Below table has all the possible Interval types.
This is a required argument. This is the number of interval we want to add in the date time. This can be positive or negative. For future dates, positive and for past dates, negative values.
This is a required argument. This is date in which you want to add that interval.
|y||Day of year (same as Day)|
|w||Weekday (same as Day)|
You can use the DateAdd function to add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 2 Months from today or a time 30 minutes from now.
The DateAdd function won’t return an invalid date. The following example adds one month to January 31:
In this case, DateAdd returns 02-Jan-95.