Java LocalDate Calculate getEndDateOfMonth(LocalDate date)

Here you can find the source of getEndDateOfMonth(LocalDate date)

Description

get End Date Of Month

License

Apache License

Declaration

public static LocalDate getEndDateOfMonth(LocalDate date) 

Method Source Code

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

import java.time.LocalDate;

public class Main {
    public static LocalDate getEndDateOfMonth(LocalDate date) {
        int[] ends = { 31, 30, 29, 28 };
        for (int e : ends) {
            try {
                LocalDate eom = date.withDayOfMonth(e);
                return eom;
            } catch (Exception ex) {
                //JUST FORGET THIS.
            }//from  w w  w  .j a  va2 s .  com
        }
        return null;
    }
}

Related

  1. getDate(Console console, Function validator)
  2. getDate(final LocalDate localDate)
  3. getDate(LocalDate d, String tzId)
  4. getDateCriteria(LocalDate startDate, LocalDate endDate)
  5. getDateStart(LocalDate localDate)
  6. getFirstDayOfTheMonth(final LocalDate date)
  7. getLastDayInMonth(LocalDate localDate)
  8. getLastDayOfTheQuarter(final LocalDate date)
  9. getLocalDateBydayAndWeek(LocalDate localDate, int weekNumber, int dayNumber)