HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Return the difference between two periods
The PERIOD_DIFF() function returns the difference between two periods. The result will be in months.
PERIOD_DIFF(period1, period2)
Parameter | Description |
---|---|
period1 | Required. A period. Format: YYMM or YYYYMM |
period2 | Required. Another period. Format: YYMM or YYYYMM |
Works in: | From MySQL 4.0 |
---|
Return the difference between two periods:
SELECT PERIOD_DIFF(201703, 201803);
Return the difference between two periods:
SELECT PERIOD_DIFF(1703, 1612);