Android Day in Month Get getNextMonthDays(String argDate)

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

Description

get Next Month Days

License

Apache License

Declaration

public static int getNextMonthDays(String argDate) 

Method Source Code

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

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {

    public static int getNextMonthDays(String argDate) {
        String[] temp = null;// www  .  j  a v  a2 s .  com
        if (argDate.indexOf("/") > 0) {
            temp = argDate.split("/");
        }
        if (argDate.indexOf("-") > 0) {
            temp = argDate.split("-");
        }
        Calendar cal = new GregorianCalendar(
                new Integer(temp[0]).intValue(),
                new Integer(temp[1]).intValue() - 1,
                new Integer(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. getNextMonthDays(String argDate)
  5. daysInMonth(Calendar c)
  6. perMonthDays(Calendar cal)
  7. numDaysToEndOfMonth()
  8. dayNumber(Date date)
  9. getDayOfWeek(long time)