Re: DATE_ISO8601 and the "c" date() character
| From: | Hannes Magnusson | Date: | Tue, 31 Jan 2006 21:41:38 +0000 |
| Subject: | Re: DATE_ISO8601 and the "c" date() character | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21748@lists.php.net to get a copy of this message | ||
Hmh. No. The patches weren't attached ;)
On 1/31/06, Hannes Magnusson <hannes.magnusson@gmail.com> wrote:
> Hi all
>
> I just noticed that the DATE_ISO8601 constant and the "c" date()
> character don't give the same results.
> The difference is that the "c" format prints colon in the timezone
> offset, but the constant does not - both are however ISO8601
> compliant.
>
> Is this intentional? If not, I'd want to change the constant rather
> then "c", since the "c" format has been there since 5.0 but the
> constant since 5.1.1.
>
> Patch attached (and patch for phpdoc).
> However! I think ISO8601 formats without the colon are more used..,
> not sure if this should be changed at all....
>
> - Hannes
>
? date.iso8601.patch.txt Index: constants.xml =================================================================== RCS file: /repository/phpdoc/en/reference/datetime/constants.xml,v retrieving revision 1.6 diff -u -r1.6 constants.xml --- constants.xml 31 Jan 2006 21:10:31 -0000 1.6 +++ constants.xml 31 Jan 2006 21:33:37 -0000 @@ -37,7 +37,7 @@ </term> <listitem> <simpara> - ISO-8601 (example: 2005-08-15T15:52:01+0000) + ISO-8601 (example: 2005-08-15T15:52:01+00:00) </simpara> </listitem> </varlistentry> Index: php_date.c =================================================================== RCS file: /repository/php-src/ext/date/php_date.c,v retrieving revision 1.43.2.40 diff -u -r1.43.2.40 php_date.c --- php_date.c 31 Jan 2006 18:44:19 -0000 1.43.2.40 +++ php_date.c 31 Jan 2006 21:28:54 -0000 @@ -236,7 +236,7 @@ #define DATE_TIMEZONEDB php_date_global_timezone_db ? php_date_global_timezone_db : timelib_builtin_db() #define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP" -#define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO" +#define DATE_FORMAT_ISO8601 "c" #define DATE_FORMAT_RFC1036 "l, d-M-y H:i:s T" #define DATE_FORMAT_RFC1123 "D, d M Y H:i:s T" #define DATE_FORMAT_RFC2822 "D, d M Y H:i:s O"
? date.iso8601.patch.txt Index: constants.xml =================================================================== RCS file: /repository/phpdoc/en/reference/datetime/constants.xml,v retrieving revision 1.6 diff -u -r1.6 constants.xml --- constants.xml 31 Jan 2006 21:10:31 -0000 1.6 +++ constants.xml 31 Jan 2006 21:33:37 -0000 @@ -37,7 +37,7 @@ </term> <listitem> <simpara> - ISO-8601 (example: 2005-08-15T15:52:01+0000) + ISO-8601 (example: 2005-08-15T15:52:01+00:00) </simpara> </listitem> </varlistentry> Index: php_date.c =================================================================== RCS file: /repository/php-src/ext/date/php_date.c,v retrieving revision 1.43.2.40 diff -u -r1.43.2.40 php_date.c --- php_date.c 31 Jan 2006 18:44:19 -0000 1.43.2.40 +++ php_date.c 31 Jan 2006 21:28:54 -0000 @@ -236,7 +236,7 @@ #define DATE_TIMEZONEDB php_date_global_timezone_db ? php_date_global_timezone_db : timelib_builtin_db() #define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP" -#define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO" +#define DATE_FORMAT_ISO8601 "c" #define DATE_FORMAT_RFC1036 "l, d-M-y H:i:s T" #define DATE_FORMAT_RFC1123 "D, d M Y H:i:s T" #define DATE_FORMAT_RFC2822 "D, d M Y H:i:s O"