PERIOD_ADD()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Adds a number of months to a starting period and returns the result.
USAGE
PERIOD_ADD(period, count)
Argument Name | Description |
---|---|
| The starting period of time |
| The number of months to add |
DETAILS
PERIOD_ADD()
is a date-time function that adds a number of months to a starting period and returns the result.
The period
argument must be in the format YYYYMM
or YYMM
.
The return value is a period in the format YYYYMM
.
A NULL
is returned if any argument is NULL
.
EXAMPLES
SELECT PERIOD_ADD(202006, 2),
PERIOD_ADD(2006, 2);
+-----------------------+---------------------+
| PERIOD_ADD(202006, 2) | PERIOD_ADD(2006, 2) |
+-----------------------+---------------------+
| 202008 | 202008 |
+-----------------------+---------------------+
SELECT PERIOD_ADD(199702, 14),
PERIOD_ADD(9702, 14);
+------------------------+----------------------+
| PERIOD_ADD(199702, 14) | PERIOD_ADD(9702, 14) |
+------------------------+----------------------+
| 199804 | 199804 |
+------------------------+----------------------+