Java Month Day getMonthLastDay()

Here you can find the source of getMonthLastDay()

Description

get Month Last Day

License

Apache License

Declaration

public static String getMonthLastDay() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getMonthLastDay() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
        return convertDate(calendar.getTimeInMillis());
    }//  w  ww  . java  2 s .c  om

    public static String convertDate(long timestamp) {
        return new SimpleDateFormat("yyyy-MM-dd").format(new Date(timestamp));
    }

    public static String format(Date date) {
        return format(date, "yyyy-MM-dd HH:mm:ss");
    }

    public static String format(Date date, String pattern) {
        return new SimpleDateFormat(pattern).format(date);
    }
}

Related

  1. getMonthFirstDay()
  2. getMonthFirstDay(Date date)
  3. getMonthFirstDay(String date)
  4. getMonthFirstDay(T date)
  5. getMonthFristWeekSunday(String month)
  6. getMonthLastDay()
  7. getMonthLastDay()
  8. getMonthLastDay(String curmonth, int month)
  9. getMonthLastDay(String dateString)