# AddYears (DateTime)

| **Name**    | ***AddYears***                                                                                                                                                                  |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | AddYears (Date date, Integer years)                                                                                                                                             |
| Purpose     | To return the date and time after adding or subtracting the number of years.                                                                                                    |
| Description | Adds or subtracts number of years to/from the specified datetime value.                                                                                                         |
| Return Type | DateTime                                                                                                                                                                        |
| Parameters  | <p>date \[System.DateTime] – Date to/from which years should be added/subtracted</p><p>years \[System.Int64] – Number of years to be added. To subtract, use negative years</p> |

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FmsBY3ZNBWHDAY60TQ4M6%2F0.png?alt=media)

**Example**

In this example, we will pass a date time value, and an integer value (indicating years to be added or subtracted) to the function transformation object using a *Variables* object.

Where,

*date* = 01-01-2022

*years* = 10

<figure><img src="https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FSn8w8xNyfKONb6ZSSqgP%2F1.png?alt=media" alt=""><figcaption></figcaption></figure>

In the output window, you can see that the provided integer value, indicating years, has been added to the given date time value.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FHaSFM9vT8I7FNtpQZI5Q%2F2.png?alt=media)
