0

When formattting (Zoned/Local)DateTimes with the DateFormatter.ISO_[*] formatters I would like to always format the date with the "fractional seconds" part present.

However every DateTime object I format which has getNanos == 0 the formatted string is in second precision.

Is there a way to force this behavior of the formatter?

(I want this because I want the logs to be easily parsable and because the ISO_8601 unfortunately expects this)

** Sidenote I'm using the Threeten lib instead of java8 itself (transitioning soon), but I dont expect this to be different between them

assylias
  • 321,522
  • 82
  • 660
  • 783
pvgoddijn
  • 12,638
  • 15
  • 47
  • 56
  • Your explanation is a little unclear - can you give an example with an input, output (actual and expected)? – assylias Jan 15 '16 at 16:08
  • 1
    Then you have to construct your own formatters using non-optional patterns for the fraction part. The built-in ISO-formatters do have such optional patterns which cannot be changed. – Meno Hochschild Jan 15 '16 at 16:24

0 Answers0