Is it possible to construct a java.time.DateFormatter such that the following are equivalent?
Instant instant = Instant.ofEpochMilli(System.currentTimeMillis());
assert instant.equals(Instant.now);
String str = String.valueOf(instant.toEpochMilli());
Instant instant = Instant.from(formatter.parse(String.valueOf(System.currentTimeMillis())));
assert instant.equals(Instant.now);
String str = formatter.format(instant);
It seems a shame to have to special-case for when your text input is using epoch millis.