RE: [PHP-DEV] rfc2616 datetime format?
| From: | Jared Williams | Date: | Mon, 04 Oct 2010 22:36:36 +0000 |
| Subject: | RE: [PHP-DEV] rfc2616 datetime format? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49866@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Derick Rethans [mailto:derick@php.net]
> Sent: 04 October 2010 09:55
> To: Stas Malyshev
> Cc: PHP Internals
> Subject: Re: [PHP-DEV] rfc2616 datetime format?
>
> On Sun, 3 Oct 2010, Stas Malyshev wrote:
>
> > > The reason is that in order to format a DateTime object
> as GMT, it
> > > needs to be converted to GMT... and you can't simply do that
with
> > > just a constant consisting of a string of format characters.
> >
> > I see what you mean and it makes sense, having constant may
> imply that
> > you can use it with any date and get proper result... But
> RFC2616 is
> > the one of the most used formats on the Web - actually, the format
> > that is called COOKIE is not the one that should be used in
> cookies -
> > RFC2616 should be used instead. COOKIE one uses T, which may or
may
> > not be GMT, depending on the date and local system
> settings. Maybe we
> > should have proper RFC format too, accompanied with appropriate
> > warning that you should use it with GMT dates (or gmdate())?
>
> Well, gmdate() is only part of it; the same constants are
> also used for the DateTime object (which is preferred over
> timestamps anyway). The problem lays exactly there because we
> can't just convert the timezone of an object just for formatting.
>
> I wanted to prevent adding just a format letter for the whole
> format as well (which would partially solve it), but we're
> almost out of letters.
> Adding a format letter that forces GMT means we would need to
> loop over the whole format string twice, making things highly
> more complicated.
>
> It is a tricky one, and let's think about whether we can come
> up with something useful here.
>
> cheers,
> Derick
>
Surely makes better sense to create a function/method for it
specifically, rather than adding new formatting letters?
Python has something like time.httpdate()
Jared