DATEADD (Report Builder 1.0)

Returns a datetime or time field type that is the result of adding the specified number of time interval units to the original datetime or time field type. The result is the same data type as the original start datetime or time field.

Syntax

DATEADD(interval, units, datetime)

interval

Specifies the units (year, quarter, month, day, hour, minute, second or week) used to calculate the date or time addition.

units

Specifies the number of intervals.

datetime

Specifies the start date or time to which the intervals are added.

Remarks

  • If the formula adds a number of time interval units to a start time, the interval unit may only be HOUR, MINUTE, or SECOND.

  • To display a datetime value as a time value, you must format the field to use one of the following custom datetime format strings on the Number tab of the Format dialog box: u, f, or s.

  • Intervals are not case-sensitive.

The following intervals are valid.

Interval

Result

YEAR

Returns a datetime or time that is the number of years specified from the datetime or time.

QUARTER

Returns a datetime or time that is the number of quarters specified from the datetime or time.

MONTH

Returns a datetime or time that is the number of months specified from the datetime or time.

WEEK

Returns a datetime or time that is the number of weeks specified from the datetime or time.

DAY

Returns a datetime or time that is the number of days specified from the datetime or time.

HOUR

Returns a datetime or time that is the number of hours specified from the datetime or time.

MINUTE

Returns a datetime or time that is the number of minutes specified from the datetime or time.

SECOND

Returns a datetime or time that is the number of seconds specified from the datetime or time.

Example

Formula

Result

DATEADD(MONTH, 3, #8/18/2009#)

11/18/2009

DATEADD(HOUR, 3, DtId)

Returns a time value for each instance of the DtId field. For example, if the original time is 07:00:01 AM, the result is 10:00:01 AM.

DATEADD(DAY, 365, Sell End Date)

Returns a sell end date for each instance that is 365 days from the original sell end date. For example, if the original sell end date is 12/18/2009, the result is 12/18/2010.