Java Day End getMonthCha(Date start, Date end)

Here you can find the source of getMonthCha(Date start, Date end)

Description

get Month Cha

License

Apache License

Declaration

public static int getMonthCha(Date start, Date end) 

Method Source Code

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

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

public class Main {
    public static int getMonthCha(Date start, Date end) {
        Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.setTime(start);/*from   www .jav a 2 s . com*/
        c2.setTime(end);
        int y1 = c1.get(Calendar.YEAR);
        int y2 = c2.get(Calendar.YEAR);
        int m1 = c1.get(Calendar.MONTH);
        int m2 = c2.get(Calendar.MONTH);
        int monthCha = (y2 - y1) * 12 + m2 - m1;
        return monthCha;
    }
}

Related

  1. getKalenderWoche(final Date date, final Locale locale)
  2. getLastDayEnding(Date date, int field)
  3. getMinllisBetween(Date beginDate, Date endDate)
  4. getMondays(Date startDate, Date endDate)
  5. getMonthBetween(Date startDate, Date endDate)
  6. getMonthCount(Date startDate, Date endDate)
  7. getMonthEnd(Date date)
  8. getMonthEndDate(Date date)
  9. getMonthEndDate(int year, int month)