ZonedDateTime.now().minusYears(5).toInstant()
That will use your default time zone to compute the time. If you want another one, specify it in now(). For example:
ZonedDateTime.now(ZoneOffset.UTC).minusYears(5).toInstant()
ZonedDateTime.now().minusYears(5).toInstant()
That will use your default time zone to compute the time. If you want another one, specify it in now(). For example:
ZonedDateTime.now(ZoneOffset.UTC).minusYears(5).toInstant()