months_diff

description

Syntax

INT months_diff(DATETIME enddate, DATETIME startdate)

The difference between the start time and the end time is months

example

  1. mysql> select months_diff('2020-12-25','2020-10-25');
  2. +-----------------------------------------------------------+
  3. | months_diff('2020-12-25 00:00:00', '2020-10-25 00:00:00') |
  4. +-----------------------------------------------------------+
  5. | 2 |
  6. +-----------------------------------------------------------+

keywords

  1. months_diff