Java Day End divMonth(Date startDate, Date enDate)

Here you can find the source of divMonth(Date startDate, Date enDate)

Description

div Month

License

Open Source License

Declaration

public static int divMonth(Date startDate, Date enDate) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static int divMonth(Date startDate, Date enDate) {
        Calendar startCalendar = Calendar.getInstance();
        startCalendar.setTime(startDate);

        Calendar endCalendar = Calendar.getInstance();
        endCalendar.setTime(enDate);/*from   w ww.ja v  a 2  s  . c  om*/

        int yearDiv = startCalendar.get(Calendar.YEAR) - endCalendar.get(Calendar.YEAR);

        int monthDiv = startCalendar.get(Calendar.MONTH) - endCalendar.get(Calendar.MONTH);

        return monthDiv + yearDiv * 12;
    }
}

Related

  1. dayEnd(final Date date)
  2. daysOfTwoDate(Date beginDate, Date endDate)
  3. dayValue(Date date, boolean startEnd)
  4. deltaInDays(Date start, Date end)
  5. deltaMonths(Date start, Date end)
  6. endOfDay(Date aDate)
  7. endOfDay(Date aDate)
  8. endOfDay(Date date)
  9. endOfDay(Date date)