79086277

Date: 2024-10-14 13:12:10
Score: 0.5
Natty:
Report link

No one has offered a succinct, modern solution that keeps the resulting date as a Date object:

Date startDate = ...
endDate = Date.from(startDate.toInstant().atZone(ZoneId.systemDefault())
    .plusYears(1).toInstant());
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Matt