Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>for <strong>parsing</strong> the size of a pattern (number of repeated characters) is not the expected size of the corresponding text. From the javadoc, for the different relevant presentation types: </p> <blockquote> <ul> <li><strong>Number</strong>: For parsing, the number of pattern letters is <strong>ignored</strong> unless it's needed to separate two adjacent fields.</li> <li><strong>Year</strong>: During parsing, only strings consisting of <strong>exactly two digits</strong> […] will be parsed into the default century. <strong>Any other</strong> numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn't all digits (for example, "-1"), is interpreted literally. So "01/02/3" or "01/02/003" are parsed, using the same pattern</li> <li><strong>Month</strong>: If the number of pattern letters is 3 or more, the month is interpreted as text; otherwise, it is interpreted as a number. </li> </ul> </blockquote> <p>The whitespace causes the parser to stop parsing the actual <em>field</em> (trailing spaces are not valid for numbers) and start with the next one. Since the pattern does not have a space between these two fields, it is not consumed and is part of the second field (leading spaces are valid). So the year got is not "exactly two digits" and will not be parsed into the default century. </p> <p>Parsing tests (<code>lenient</code> set to <code>false</code>): </p> <pre><code>FORMAT TEXT RESULT (ISO yyyy-MM-dd) ------------------------------------------------- dddyy 01011 2011-01-10 dddyy 10 11 0011-01-10 (year is 3 chars: " 11") dddyy 10 1 0001-01-10 (year is 2 char but not 2 digits: " 1") dddy 01011 2011-01-10 ("y" same as "yy") dd yy 10 11 2011-01-10 (ok, whitespace is consumed, year: "11") d/y 3/4 0004-01-03 (year is not 2 digits) d/y 3/04 2004-01-03 M/d/y 4/6/11 2011-04-06 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload