Java Date After getDateScopeAfterMonth(int year, int month)

Here you can find the source of getDateScopeAfterMonth(int year, int month)

Description

get Date Scope After Month

License

Open Source License

Declaration

public static Date[] getDateScopeAfterMonth(int year, int month) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {

    public static Date[] getDateScopeAfterMonth(int year, int month) {
        Date[] date = new Date[2];

        Calendar cal = new GregorianCalendar();
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.MONTH, month - 1);
        cal.set(Calendar.DAY_OF_MONTH,
                cal.getActualMinimum(Calendar.DAY_OF_MONTH));
        cal.set(Calendar.HOUR_OF_DAY,
                cal.getActualMinimum(Calendar.HOUR_OF_DAY));
        cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE));
        cal.set(Calendar.SECOND, cal.getActualMinimum(Calendar.SECOND));
        cal.set(Calendar.MILLISECOND,
                cal.getActualMinimum(Calendar.MILLISECOND));
        date[0] = cal.getTime();/*ww w. j  av a 2  s  .  c o m*/

        cal.set(Calendar.MONTH, cal.getActualMaximum(Calendar.MONTH));
        cal.set(Calendar.DAY_OF_MONTH,
                cal.getActualMaximum(Calendar.DAY_OF_MONTH));
        cal.set(Calendar.HOUR_OF_DAY,
                cal.getActualMaximum(Calendar.HOUR_OF_DAY));
        cal.set(Calendar.MINUTE, cal.getActualMaximum(Calendar.MINUTE));
        cal.set(Calendar.SECOND, cal.getActualMaximum(Calendar.SECOND));
        cal.set(Calendar.MILLISECOND,
                cal.getActualMaximum(Calendar.MILLISECOND));
        date[1] = cal.getTime();

        return date;
    }
}

Related

  1. getDateAfter(Date d, int day)
  2. getDateAfter(Date date, int days)
  3. getDateAfter(Date date, int increment)
  4. getDateAfterAddition(Date date, int days)
  5. getDateAfterMonths(Date start, int months)
  6. getDateTimeAfter(final Date _from, final int _time_type, final int _count)
  7. getMonthAfter(final Date _from, final int _mons)
  8. getNDayAfterCurrentDate(int n)
  9. getSpecifiedDayAfter(Date date, int num)