Skip to content

Commit e61b19a

Browse files
committed
Clarify parsing just the year after two notes were created for this
1 parent 5537c5f commit e61b19a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

reference/datetime/formats.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,15 @@ object(DateTimeImmutable)#1 (3) {
556556

557557
<note>
558558
<para>
559-
The "Year (and just the year)" format only works if a time string
560-
has already been found -- otherwise this format is recognised as
561-
<literal>HH</literal> <literal>MM</literal>.
559+
The "Year (and just the year)" format only reliably works if a time string
560+
has already been found. Otherwise, if the four digit year matches
561+
<literal>HH</literal> <literal>MM</literal> then these two date elements
562+
are set instead.
563+
</para>
564+
<para>
565+
To consistently parse just a year, use
566+
<function>DateTimeImmutable::createFromFormat</function> with the
567+
<literal>Y</literal> specifier.
562568
</para>
563569
</note>
564570

0 commit comments

Comments
 (0)