Java Day End getMonthSpan(Date begin, Date end)

Here you can find the source of getMonthSpan(Date begin, Date end)

Description

get Month Span

License

Apache License

Declaration

public static int getMonthSpan(Date begin, Date end) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {

    public static int getMonthSpan(Date begin, Date end) {
        Calendar beginCal = new GregorianCalendar();
        beginCal.setTime(begin);/*from   w ww .ja va 2s .com*/
        Calendar endCal = new GregorianCalendar();
        endCal.setTime(end);
        int m = (endCal.get(Calendar.MONTH)) - (beginCal.get(Calendar.MONTH));
        int y = (endCal.get(Calendar.YEAR)) - (beginCal.get(Calendar.YEAR));
        return y * 12 + m;
    }
}

Related

  1. getMonthEndDate(int year, int month)
  2. getMonthEndDate(Long day)
  3. getMonthFirstDays(Date startDate, Date endDate)
  4. getMonths(Date end, Date start)
  5. getMonthsBetweenBeginDateAndEndDate(Date beginDate, Date endDate)
  6. getMonthSpan(Date start, Date end)
  7. getMsBetween(Date startDate, Date endDate)
  8. getNextEndDate(Date date, int offset)
  9. getNextSendTime(Date sendDate, Date start)