> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# years_add

> 向日期时间或日期值添加指定年数。

向 `expr1` 添加指定的时间间隔，单位为年。

## 语法

```Haskell theme={null}
DATETIME years_add(DATETIME|DATE expr1,INT expr2);
```

## 参数说明

`expr1`: 支持的数据类型为 DATETIME 或 DATE。

`expr2`: 支持的数据类型为 INT，单位为年。

## 返回值说明

返回值的数据类型为 DATETIME。

## 示例

```Plain Text theme={null}
select years_add('2010-11-30 23:50:50', 2);
+-------------------------------------+
| years_add('2010-11-30 23:50:50', 2) |
+-------------------------------------+
| 2012-11-30 23:50:50                 |
+-------------------------------------+

select years_add('2010-11-30', 2);
+----------------------------+
| years_add('2010-11-30', 2) |
+----------------------------+
| 2012-11-30 00:00:00        |
+----------------------------+
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.