public int getDurationInYears ( XMLGregorianCalendar startDate , XMLGregorianCalendar endDate ) { int startYear = startDate . getYear ( ) ; final int dec = 12 ; if ( startDate . getMonth ( ) == dec ) { // started in December, increase year with one startYear ++ ; } int endYear = endDate . getYear ( ) ; return endYear - startYear ; }
Determines number of years between two dates so that premium duration can be established .