Java Day of Month getLastDayOfLastMonth()

Here you can find the source of getLastDayOfLastMonth()

Description

get Last Day Of Last Month

License

Open Source License

Declaration

public static String getLastDayOfLastMonth() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

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

public class Main {

    public static String getLastDayOfLastMonth() {
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.add(Calendar.DAY_OF_MONTH, -1);
        return format.format(cal.getTime());
    }//w w  w. j  a  v  a2s  .co m
}

Related

  1. getLastDateOfCurMonth()
  2. getLastDay(int year, int month)
  3. getLastDayByMonthWeek(int year, int month, int week)
  4. getLastDayInMonth(int year, int month)
  5. getLastDayOfCurMonth()
  6. getLastDayOfMonth()
  7. getLastdayofMonth()
  8. getlastDayOfMonth()
  9. getLastDayOfMonth()