DATEADD function

DATEADD(<Source date>, SECOND | MINUTE | HOUR | DAY| WEEK | MONTH | QUARTER | YEAR | TENDAYS| HALFYEAR, <Increase size>)

This function is used to add values to a date.

The first parameter is a source date which is to be added with the value defined by the second and third parameters; it's an expression of DATE type.

The second parameter, i.e. the increase size, can be set to SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, TENDAYS, HALFYEAR.

The third parameter is the value which is to be added to the date specified by the first parameter. It's a value of NUMBER type (fractional part is ignored).

Examples:

SELECT DATEADD(DATETIME(2002, 10, 12, 10, 15, 34), MONTH, 1)

Result:

Field1

12.11.2002 10:15:34

SELECT DATEADD(DATETIME(2002, 10, 12, 10, 15, 34), DAY, 5)

Result:

Field1

17.10.2002 10:15:34

 

See also: Functions of Query Language

1C:Enterprise Developer's Community