79745287

Date: 2025-08-25 02:05:04
Score: 0.5
Natty:
Report link

This is a Locale independent solution. Note: If today is Monday (or Sunday) will return the current day.

LocalDate today = LocalDate.now();
LocalDate lastMonday = today.minusDays(today.getDayOfWeek().getValue() - 1);
LocalDate lastSunday = today.minusDays(today.getDayOfWeek().getValue() % 7);
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Herman Sidharta