Re: rfc2616 datetime format?
| From: | Hannes Magnusson | Date: | Mon, 04 Oct 2010 11:17:59 +0000 |
| Subject: | Re: rfc2616 datetime format? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49863@lists.php.net to get a copy of this message | ||
On Mon, Oct 4, 2010 at 11:29, Pierre Joye <pierre.php@gmail.com> wrote:
> On Mon, Oct 4, 2010 at 10:42 AM, Derick Rethans <derick@php.net> wrote:
>> On Mon, 4 Oct 2010, Pierre Joye wrote:
>>
>>> On Mon, Oct 4, 2010 at 1:27 AM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>>> >
>>> >> It looks like a sub optimal choice to have used string constants
>>> >> instead of integer. However it could be still possible to define new
>>> >> constants as numeric. It is then possible to do whatever needs to be
>>> >> done as post or pre ops for the respective constants.
>>> >
>>> > I'm not sure what integers have to do with it? The constants define date
>>> > formats that are in common use, RFC2616 is one of the commonest on the web
>>> > and we don't have a constant for it...
>>>
>>> I mean in ext/date and as a reply to Derick, not your request which is
>>> totally valid. A date time object has the timezone information. If the
>>> constants were integers, it would be very straightforward to do some
>>> operations before calling the formatting functions depending on a
>>> given predefined format. It should still be possible to do it by
>>> testing the string contents (strncmp), but that's not very clean.
>>
>> Stop talking about something you don't know anything about, please.
>> Those constants are not *one* format letter, they are many. Maybe you
>> could have tried this:
>>
>> echo DateTime::RFC822, "\n";
>
> Maybe you could read what I wrote instead of replying in such stupid
> manner, that could lead the discussions in a constructive direction,
> thanks.
>
> Key parts were:
>
> 1. using integer makes such features easier to implement (basic good
> practice/programming 101)
> 2. use strncmp to compare the format (yes, strncmp supports many characters)
Are you proposing that the constants become integers?
so, DATE_RFC_1234 will be equal to "1234"?
And then date(DATE_RFC_1234); will print out formatted string?
I am afraid that would break craploads of applications, and become
very confusing.
-Hannes