Consider a code:
TemporalAccessor date = DateTimeFormatter.ofPattern(\"yyyy-MM-dd\").parse(\"9999-12-31\");
Instant.from(date);
The last line t
Either you are only interested in the date itself (31st of December 9999), in which case the appropriate type would be a LocalDate
:
LocalDate date = LocalDate.parse("9999-12-31");
Or you do want an Instant
, in which case you need to set a time and time zone, for example, 00:00
in Tokyo:
Instant instant = date.atStartOfDay(ZoneId.of("Asia/Tokyo")).toInstant();