MySQL has a PERIOD_DIFF() function that enables you to find the difference between two periods. The periods are provided as two separate arguments, and they should in the format YYMM or YYYYMM.
date functions
MAKEDATE() Examples – MySQL
When using MySQL, you can use the MAKEDATE() function to return a date from the year and day-of-year parts.
In other words, you provide two arguments; one being the year, and the other being the day-of-year. The MAKEDATE() function will then return the date value based on those two arguments.