LocalDate now = LocalDate.now();
LocalDate lastDay = now.with(TemporalAdjusters.lastDayOfMonth());
TemporalAdjusters contains common and useful adjusters. Adjusters are a key tool for modifying temporal objects. They exist to externalize the process of adjustment, permitting different approaches, as per the strategy design pattern.
lastDayOfMonth() method returns a new date set to the last day of the current month. Use it as a parameter for the
with() method on your
LocalDate object. The
with() method returns an adjusted copy of this date.
- Get the last Friday of a month in Java
- Get the first Monday of a month in Java
- Get the first day of the week in Java
- Get the first day of the current month in Java
- Get the last day of a month in Java
- Get the number of days between two dates in Java
- Get yesterday's date in Java
- Get tomorrow's date in Java
- Get actual date in Java