Counting months elapsed since deposit

 

Hello, I'm trying to develop a telegram bot that sends a csv history for a desired lapse of time. Untill now I managed to make it send the history of last day, last week last month and total history. I was wondering. Is there any simple way to count months elapsed since deposit and fill an array with those months? Like this for example:


int CountAvailableMonths()
{



if(Month > DateTime(Deposit))
ElapsedMonths++;


for(int i=0;i<ElapsedMonths;i++)
  {
   
   CreateButton();
   
   
  }


}