Android Month Date Get getEndCurrentMonth()

Here you can find the source of getEndCurrentMonth()

Description

get End Current Month

Declaration

public static long getEndCurrentMonth() 

Method Source Code

//package com.java2s;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static long getEndCurrentMonth() {
        return getEndCurrentMonthCal().getTimeInMillis();
    }//  ww  w . j a  va 2 s .c  o m

    public static Calendar getEndCurrentMonthCal() {
        Calendar calendar = getCalendar();
        calendar.set(Calendar.DAY_OF_MONTH,
                calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        calendar.set(Calendar.MILLISECOND, 999);

        return calendar;
    }

    private static Calendar getCalendar() {
        Calendar calendar = GregorianCalendar.getInstance();
        calendar.setTime(new Date());
        return calendar;
    }
}

Related

  1. getMonth()
  2. getCurrentMonth()
  3. getStringMonth(Date date)
  4. getMonth(int month, Locale locale)
  5. getMonthName(String substring)
  6. getEndCurrentMonthCal()
  7. getStartCurrentMonth()
  8. getStartCurrentMonthCal()