I have had to look up how to format Java’s Instant with a given resolution - for example in microseconds or nanoseconds. After fiddling with various formatters, I was happy to finally get this right.

public void shouldFormatWith7Decimals() {
  int resolution = 7;
  DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder()
  Instant instant = Instant.now();

If you have questions or comments about this blog post, you can get in touch with me on Twitter @sdqali.

If you liked this post, you'll also like...