Java Month Day getLastMonthLastDate()

Here you can find the source of getLastMonthLastDate()

Description

get Last Month Last Date

License

Apache License

Declaration

public static Date getLastMonthLastDate() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static Date getLastMonthLastDate() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH, -1);
        int max = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        calendar.set(Calendar.DAY_OF_MONTH, max);
        return calendar.getTime();
    }/*from w  ww . ja va2  s  .c  om*/

    public static String getTime() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString = formatter.format(currentTime);
        String min;
        min = dateString.substring(14, 16);
        return min;
    }
}

Related

  1. getFirstDayOfMonth(Long date)
  2. getFirstDayOfNextMonth()
  3. getFirstDayStringOfMonth(Date date)
  4. getFirstDayStrOfMonth(Date date)
  5. getLastMonthDay()
  6. getLastMonthLastDay()
  7. getLastMonthLastDay()
  8. getLastMothStart()
  9. GetLastWorkDayofMonth(String strDateStart)