Java Month Calculate endOfLastMonth()

Here you can find the source of endOfLastMonth()

Description

end Of Last Month

License

Apache License

Declaration

public static long endOfLastMonth() 

Method Source Code

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

import java.util.*;

public class Main {

    public static long endOfLastMonth() {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.set(Calendar.HOUR_OF_DAY, 23);
        cal.set(Calendar.MINUTE, 59);
        cal.set(Calendar.SECOND, 59);
        cal.set(Calendar.MILLISECOND, 999);
        cal.add(Calendar.DATE, -1);
        Date date = cal.getTime();
        return date.getTime();
    }//from   w w  w.  j  a  va  2s .  c  o  m
}

Related

  1. alignMonth(Calendar timestamp)
  2. beforeAMonth()
  3. calendarMonthToInt(int calendarMonth)
  4. currentMonth()
  5. divideIntoMonthlyIntervals(Date start, Date end)
  6. getAgeInMonths(Date startDate, Date endDate)
  7. getAlphaMonth(String mon)
  8. getCurrentMonth()
  9. getCurrentMonth()