Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed formats and example for localized notations under compound formats #3410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

genius257
Copy link

No description provided.

@@ -784,7 +784,7 @@ object(DateTimeImmutable)#1 (3) {
<tbody>
<row>
<entry>Common Log Format</entry>
<entry><literal>dd</literal> "/" <literal>M</literal> "/" <literal>YY</literal> : <literal>HH</literal> ":" <literal>II</literal> ":" <literal>SS</literal> <literal>space</literal> <literal>tzcorrection</literal></entry>
<entry><literal>DD</literal> "/" <literal>M</literal> "/" <literal>YY</literal> ":" <literal>HH</literal> ":" <literal>II</literal> ":" <literal>SS</literal> <literal>space</literal> <literal>tzcorrection</literal></entry>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding " around : is correct, but changing DD to dd is not. The parsing rule has:

/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
clf              = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;

With day defined as:

day   = (([0-2]?[0-9]) | ("3"[01])) daysuf?;

the dd and mm rules are however missing in the table here (whereas DD and MM are included). These rows needs to be copied from the table for "Date Formats (https://www.php.net/manual/en/datetime.formats.php#datetime.formats.date)".

<entry><literal>YY</literal> "-" <literal>mm</literal> "-" <literal>dd</literal> "T" <literal>hh</literal> ":" <literal>ii</literal> ":" <literal>ss</literal></entry>
<entry>"2008-7-1T9:3:37"</entry>
<entry><literal>YY</literal> "-" <literal>MM</literal> "-" <literal>DD</literal> "T" <literal>hh</literal> ":" <literal>ii</literal> ":" <literal>ss</literal></entry>
<entry>"2008-07-01T09:03:37"</entry>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a correct change. mm and dd mean either one or two digits, where MM and DD format as leading-0 strings.

The parsing rule in parse_date.re is:

wddx             = year4 "-" month "-" day "T" hour24 ":" minute ":" second;

with month and day specified as:

month = "0"? [0-9] | "1"[0-2];
day   = (([0-2]?[0-9]) | ("3"[01])) daysuf?;

Please remember that these are rules to parse these formats, and not output formats (there are no WDDX and CLF constants).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants