Java Day of Month getLastDayOfMonth()

Here you can find the source of getLastDayOfMonth()

Description

get Last Day Of Month

License

Apache License

Declaration

public static String getLastDayOfMonth() 

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 SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");

    public static String getLastDayOfMonth() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        final int lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        Date lastDate = calendar.getTime();
        lastDate.setDate(lastDay);/*from   w w  w. ja v  a  2s . co  m*/
        return sdf2.format(lastDate);
    }
}

Related

  1. getLastDayInMonth(int year, int month)
  2. getLastDayOfCurMonth()
  3. getLastDayOfLastMonth()
  4. getlastDayOfMonth()
  5. getLastdayofMonth()
  6. getLastDayOfMonth()
  7. getLastDayOfMonth(Calendar c)
  8. getLastDayOfMonth(Date currDate)
  9. getLastDayOfMonth(Date date)