| --- |
| { |
| "title": "DATE_ADD", |
| "language": "en" |
| } |
| --- |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| ## date_add |
| ### Description |
| #### Syntax |
| |
| `DATETIME DATE_ADD(DATETIME date, INTERVAL expr type)` |
| |
| |
| Adds a specified time interval to the date. |
| |
| The date parameter is a valid date expression. |
| |
| The expr parameter is the interval you want to add. |
| |
| The type parameter can be the following values: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND |
| |
| ### example |
| |
| ``` |
| mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY); |
| +-------------------------------------------------+ |
| | date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) | |
| +-------------------------------------------------+ |
| | 2010-12-02 23:59:59 | |
| +-------------------------------------------------+ |
| ``` |
| ### keywords |
| DATE_ADD,DATE,ADD |