Mysql Period_add Function


This tutorial explains how to use the MySQL PERIOD_ADD function with syntax and examples.


The MySQL PERIOD_ADD function takes a period (formatted as YYMM or YYYYMM) and adds a specified number of months to it.


The syntax for the PERIOD_ADD function in MySQL is:

PERIOD_ADD( period, number )

Parameters or Arguments


A period formatted as either YYMM or YYYYMM.


The number of months to add to the period. It can be a positive or negative value.


  • The PERIOD_ADD function will return the result formatted as YYYYMM.

Applies To

The PERIOD_ADD function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23


Let's look at some MySQL PERIOD_ADD function examples and explore how to use the PERIOD_ADD function in MySQL.

For example:

mysql> SELECT PERIOD_ADD(201402,5);
Output: 201407

mysql> SELECT PERIOD_ADD(201402,6);
Output: 201408

mysql> SELECT PERIOD_ADD(201402,12);
Output: 201502

mysql> SELECT PERIOD_ADD(201402,16);
Output: 201506

mysql> SELECT PERIOD_ADD(201402,-1);
Output: 201401

mysql> SELECT PERIOD_ADD(1402,5);
Output: 201407

mysql> SELECT PERIOD_ADD(1402,6);
Output: 201408