Java calculate the amount of months between two dates

https:‮//‬www.lautturi.com
Java calculate the amount of months between two dates
/**
 * @author lautturi.com 
 * Java example: compute the number of months between two dates in java
 */

import java.util.*;
import java.time.LocalDate;
import java.time.temporal.*;

public class Lautturi {

	public static void main(String[] args){

		LocalDate start = LocalDate.parse("2020-10-13");
		LocalDate end = LocalDate.parse("2021-11-05");

		long diff = ChronoUnit.MONTHS.between(start, end);

	    System.out.println("months between two dates: " +  diff);
	
	}
}

output:

months between two dates: 12
Created Time:2017-09-24 20:23:47  Author:lautturi