`DateTimeFormatter` to handle either a FULL STOP or COMMA in fractional second
<p>In the <a href="http://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html" rel="nofollow">java.time</a> classes, how do we specify a formatting pattern for a <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html" rel="nofollow"><code>DateTimeFormatter</code></a> that allows for either a FULL STOP (<code>.</code>) (period or dot) or a COMMA (<code>,</code>) as the delimiter of a fractional second?</p>

<p>For example, the following works for parsing an input date value ending in either <code>.0Z</code> or <code>,0Z</code> in <code>20090813145607.0Z</code> and <code>20090813145607,0Z</code>.</p>

<pre><code>String input = "20090813145607.0Z";
DateTimeFormatter f = DateTimeFormatter.ofPattern ( "uuuuMMddHHmmss[,S][.S]X" );
</code></pre>

<p>But for printing, the output contains <em>both</em>, generating a repeated pair of fractional seconds.</p>

<blockquote>
  <p>20090813145607,0.0Z</p>
</blockquote>

<p>So I deduce I my use of <code>[,S][.S]</code> in the formatting pattern is not the correct way to get this functionality.</p>

<h1><code>DecimalStyle</code></h1>

<p>I tried to use the <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#withDecimalStyle-java.time.format.DecimalStyle-" rel="nofollow"><code>DateTimeFormatter::withDecimalStyle</code></a> method passing a <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DecimalStyle.html" rel="nofollow"><code>DecimalStyle</code></a>, but that failed to behave as I expected in my experiments. The documentation does not really explain its intended behavior.</p>

<p>This issue is important as the <a href="https://en.wikipedia.org/wiki/ISO_8601" rel="nofollow">ISO 8601</a> standard recommends using the COMMA but allows the FULL STOP. Either is commonly used in practice.</p>

<h1><code>Instant</code> cannot tolerate a comma</h1>

<p>Perhaps this tolerance of comma and/or dot as <a href="https://en.wikipedia.org/wiki/Decimal_mark" rel="nofollow">decimal mark</a> is not possible in java.time. </p>

<p>I tried the following code with Java 8 Update 102. The first input with a FULL STOP (dot) succeeds while the second input with a COMMA fails.</p>

<pre><code>String inputDot = "2016-01-02T12:34:56.7Z";  // Succeeds.
Instant instantDot = Instant.parse ( inputDot );

String inputComma = "2016-01-02T12:34:56,7Z";  // Fails. Throws a DateTimeParseException.
Instant instantComma = Instant.parse ( inputComma );
</code></pre>