AddYr function

Official Content
This documentation is valid for:

Adds a given number of years to a given date.

Syntax

AddYr(date-expression | datetime-expression , numeric-expression)

Type returned
Date | DateTime

Where:

date-expression | datetime-expression 
   Given date or datetime.

numeric-expression
    The number of years added to the date-expression | datetime-expression.

Description

Returns a value which results from adding numeric-expression years to date-expression or datetime-expression. When the type assigned is date it returns a date value and when the type assigned is datetime it returns a datetime.

Examples

Date1 = CtoD('29/02/2008')
Date2 = AddYr(Date1, 1)
// Result: Date2 = 28/02/2009 if Date2 is a date type attribute
Date3 = AddYr(Date1,-1)
// Result: Date3 = 28/02/2007 if Date3 is a date type attribute
Date4 = AddYr(Today(), 1)    //Today() = 18/12/2008
// Result: Date4 = 18/12/2009 00:00:00 if Date4 is a datetime type attribute
Date5 = AddYr(Now(), -2)   //Now() = 12/06/2008 10:30:00
// Result: Date5 = 12/06/2006 if Date5 is a date type attribute
// Result: Date5 = 12/06/2006 10:30:00 if Date5 is a datetime type attribute

Scope

Objects   Procedure object, Transaction object, Web Panel object

See also

AddMth function
Add days syntax