DateAdd
This function allows to add any number of intervals of any size to a date/time value. You can calculate time (days, minutes) in the future or in the past.
Compatibility
Available as of IDEA version 10.0
Syntax
DateAdd(interval as String, number as Int32, date as DateTime)
Parameter
interval
A string expression indicating the interval of time to add.
number
Number of intervals to add. It can be positive (to get dates in the future) or negative (for dates in the past).
date
Date to which the interval is added.
| Setting | Description |
|---|---|
|
YYYY |
Year |
|
q |
Quarter |
|
m |
Month |
|
y |
Day of year |
|
d |
Day |
|
w |
Weekday |
|
ww |
Week |
|
h |
Hour |
|
n |
Minute |
|
s |
Second |
Examples:
To find the date one year from the current date, you could use an expression like this:
DateAdd("yyyy", 1, date)
Calculating the time two hours from now:
DateAdd("h", 2, Now)