Java Month getMonthRange(String start, String end)

Here you can find the source of getMonthRange(String start, String end)

Description

get Month Range

License

Open Source License

Declaration

public static int getMonthRange(String start, String end) 

Method Source Code

//package com.java2s;

public class Main {

    public static int getMonthRange(String start, String end) {
        int range = 0;
        try {/*from  w w w.j  a v  a  2 s.c o m*/
            String yearEnd = end.substring(0, 4);
            String monthEnd = end.substring(4);
            String yearStart = start.substring(0, 4);
            String monthStart = start.substring(4);

            range = (Integer.parseInt(yearEnd) - Integer.parseInt(yearStart)) * 12 + Integer.parseInt(monthEnd)
                    - Integer.parseInt(monthStart) + 1;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return range;
    }
}

Related

  1. getMonthLength(final int year, final int month)
  2. getMonthLength(int year, int m)
  3. getMonthLength(int year, int month)
  4. getMonthMaxDate(String str)
  5. getMonthOfNextQuarter(String yearAndMonth)
  6. getMonths()
  7. getMonths(String strDateBegin, String strDateEnd)
  8. getMonthTime(String allDate)
  9. getMonthToMonth(int month)