Android Day in Month Get numDaysToEndOfMonth()

Here you can find the source of numDaysToEndOfMonth()

Description

num Days To End Of Month

License

Open Source License

Declaration

public static int numDaysToEndOfMonth() 

Method Source Code

//package com.java2s;

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

public class Main {
    public static int numDaysToEndOfMonth() {
        return maxMonthDate(new Date()) - dayNumber(new Date());
    }//from  w ww . ja va  2 s . com

    public static int maxMonthDate(Date date) {
        Calendar calendar = calendarDate(date);
        return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    }

    public static int dayNumber(Date date) {
        Calendar calender = calendarDate(date);
        return calender.get(Calendar.DAY_OF_MONTH);
    }

    public static Calendar calendarDate(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar;
    }
}

Related

  1. getDaysInMonth(int month, int year)
  2. getNextMonthDays(String argDate)
  3. daysInMonth(Calendar c)
  4. getNextMonthDays(String argDate)
  5. perMonthDays(Calendar cal)
  6. dayNumber(Date date)
  7. getDayOfWeek(long time)
  8. getStringDayOfMonth(Date date)
  9. getFirstDayOfMonth(String format)