Get the first Monday of a month in Java
Question:
How to get the first Monday of a month in Java? Answer:
LocalDate now = LocalDate.now();
LocalDate firstMonday = now.with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY));
Description:
Use the firstInMonth()
method, which returns the first in month adjuster, which returns a new date in the same month with the first matching day-of-week. This is used for expressions like 'first Monday in the actual month'.
Reference:
Java firstInMonth reference
Share "How to get the first Monday of a month in Java?"
Related snippets:
- 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
Tags:
first monday, first monday of month, get first monday of month java, Technical term:
Get the first Monday of a month in Java