Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49861 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92772 invoked from network); 4 Oct 2010 08:55:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2010 08:55:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:45885] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/A2-11706-E6699AC4 for ; Mon, 04 Oct 2010 04:55:11 -0400 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id 4B65EDE13E; Mon, 4 Oct 2010 09:55:08 +0100 (BST) Date: Mon, 4 Oct 2010 09:55:08 +0100 (BST) X-X-Sender: derick@kossu.derickrethans.nl To: Stas Malyshev cc: PHP Internals In-Reply-To: <4CA910FD.1040900@sugarcrm.com> Message-ID: References: <4CA6885F.3040709@sugarcrm.com> <4CA910FD.1040900@sugarcrm.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] rfc2616 datetime format? From: derick@php.net (Derick Rethans) 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