Android Day in Month Get getNextMonthDays(String argDate)

Here you can find the source of getNextMonthDays(String argDate)

Description

get Next Month Days

Declaration

public static int getNextMonthDays(String argDate) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    public static int getNextMonthDays(String argDate) {
        String[] temp = null;// www.j  a v  a 2  s . c  om
        if (argDate.indexOf("/") > 0) {
            temp = argDate.split("/");
        }
        if (argDate.indexOf("-") > 0) {
            temp = argDate.split("-");
        }
        Calendar cal = new GregorianCalendar(Integer.valueOf(temp[0])
                .intValue(), Integer.valueOf(temp[1]).intValue() - 1,
                Integer.valueOf(temp[2]).intValue());
        int curMonth = cal.get(Calendar.MONTH);
        cal.set(Calendar.MONTH, curMonth + 1);

        int curyear = cal.get(Calendar.YEAR);
        curMonth = cal.get(Calendar.MONTH);

        int mArray[] = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31,
                30, 31 };
        if ((curyear % 400 == 0)
                || ((curyear % 100 != 0) && (curyear % 4 == 0))) {
            mArray[1] = 29;
        }
        return mArray[curMonth];
    }
}

Related

  1. getDaysInMonth(int month, int year)
  2. daysInMonth(int day, int month, int year)
  3. getDaysInMonth(int month, int year)
  4. daysInMonth(Calendar c)
  5. getNextMonthDays(String argDate)
  6. perMonthDays(Calendar cal)
  7. numDaysToEndOfMonth()