👩💻 Join our community of thousands of amazing developers!
Get current day with LocalDateTime.now() from which you can substract years, weeks, days up to nanos (in the shown example days with minusDays(long days)): LocalDateTime dateToLookBack = LocalDateTime.now().minusDays(30); You can achieve the same result by using the minus(TemporalAmount amountToSubtract) method as below final var dateToLookBackTo = LocalDateTime.now().minus(Duration.ofDays(30)); Reference - https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html ...