I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Ja
Using java.time library built into Java 8 and later, you may use TemporalAdjusters.lastInMonth:
val now = LocalDate.now()
val lastInMonth = now.with(TemporalAdjusters.lastInMonth(DayOfWeek.FRIDAY))
You may choose any day from the DayOfWeek enum.
If you need to add time information, you may use any available LocalDate to LocalDateTime conversion like
lastFriday.atStartOfDay() // e.g. 2015-11-27T00:00