Skip to main content
Version: V1.0.0

PERIOD_DIFF

Declaration

PERIOD_DIFF(p1, p2)

Description

Returns the interval between two dates in months. The date can only contain year and month information, and the format must be YYYYMM or YYMM.

Example

SELECT PERIOD_DIFF(200802, 200703);
+-----------------------------+
| PERIOD_DIFF(200802, 200703) |
+-----------------------------+
| 11 |
+-----------------------------+
1 row in set (0.001 sec)