Android Date Interval Get getInterval(String beginMonth, String endMonth)

Here you can find the source of getInterval(String beginMonth, String endMonth)

Description

get Interval

License

Apache License

Declaration

public static int getInterval(String beginMonth, String endMonth) 

Method Source Code

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

public class Main {
    public static int getInterval(String beginMonth, String endMonth) {
        int intBeginYear = Integer.parseInt(beginMonth.substring(0, 4));
        int intBeginMonth = Integer.parseInt(beginMonth
                .substring(beginMonth.indexOf("-") + 1));
        int intEndYear = Integer.parseInt(endMonth.substring(0, 4));
        int intEndMonth = Integer.parseInt(endMonth.substring(endMonth
                .indexOf("-") + 1));

        return ((intEndYear - intBeginYear) * 12)
                + (intEndMonth - intBeginMonth) + 1;
    }//from  w ww.j  av a 2  s.c o m
}

Related

  1. getDiffHour(String startTime, String endTime)
  2. getFragment(Calendar calendar, int fragment, int unit)
  3. getFragment(Date date, int fragment, int unit)
  4. getFragmentInDays(Date date, int fragment)
  5. getFragmentInHours(Date date, int fragment)
  6. getIntervalDays(Date minDate, Date maxDate)
  7. getIntervalDays(String sd, String ed)
  8. getIntervalHours(Date minDate, Date maxDate)
  9. getIntervalMinutes(Date minDate, Date maxDate)