I would like to convert instances of class java.time.Instant
to and from Strings.
I would like to use a format exactly like java.time.format.DateTimeFormatter.ISO_INSTANT
with the only difference that the colons in the format are omitted or replaced by dots so that they can be used without escaping in file names and URLs.
Example: 2011-12-03T10.15.30.001Z instead of 2011-12-03T10:15:30.001Z
See Javadoc for ISO_INSTANT: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ISO_INSTANT
You could build your own formatter like this:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH.mm.ss.SSSVV")
The DateTimeFormatter
Javadoc lists all possible tokens with their signification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With