Doc #79304 [Opn]: Doc. for DateTime::createFromFormat/date_create_from_format not consistent

From: Date: Tue, 25 Feb 2020 00:43:39 +0000
Subject: Doc #79304 [Opn]: Doc. for DateTime::createFromFormat/date_create_from_format not consistent
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17336@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79304&edit=1

 ID:                 79304
 Updated by:         derick@php.net
 Reported by:        patrick dot kuijvenhoven at gmail dot com
 Summary:            Doc. for
                     DateTime::createFromFormat/date_create_from_format
                     not consistent
 Status:             Open
 Type:               Documentation Problem
 Package:            Documentation problem
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

This makes it read really weirdly, so I would say "Won't Fix" - if at all, change the
examples around.


Previous Comments:
------------------------------------------------------------------------
[2020-02-24 20:11:00] patrick dot kuijvenhoven at gmail dot com

The following patch has been added/updated:

Patch Name: createfromformat.patch
Revision:   1582575060
URL:        https://bugs.php.net/patch-display.php?bug=79304&patch=createfromformat.patch&revision=1582575060

------------------------------------------------------------------------
[2020-02-24 19:57:21] patrick dot kuijvenhoven at gmail dot com

Description:
------------
Reference https://www.php.net/manual/en/datetime.createfromformat.php

Please notice where X and Y are present in each column in the following table:

+---------------------+------------------------------+-----------------+
| format              | description                  | example         |
+---------------------+------------------------------+-----------------+
| X and Y             | ...  with (X) or without (Y) | 01 to 31 (X) or |
| (alphabetical sort) |  leading zeros ...           |  1 to 31 (Y)    |
+---------------------+------------------------------+-----------------+

This style works for "d and j", "D and l", "m and n".

The time variants "g and h" and "G and H" do not follow this style. 

This can be fixed by replacing "with or without" to "without or with" in the
"description" column for these formats. So, suggested to rewrite as:

+--------------+-------------------------+--------------------------------+
| format       | description             | example                        |
+--------------+-------------------------+--------------------------------+
| g and h      | ... without or with ... | 01 thought 12 or 01 through 12 |
| G and H      | ... without or with ... | 0 thought 23 or 00 through 23  | 
+--------------+-------------------------+--------------------------------+

Another option could be to explicitly mention the format in the description, thus like "...
without (G) or with (H) ...".




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79304&edit=1


Thread (13 messages)

« previous php.doc.bugs (#17336) next »