Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62736 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64806 invoked from network); 3 Sep 2012 12:58:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 12:58:32 -0000 Authentication-Results: pb1.pair.com header.from=wfitch@meetme.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=wfitch@meetme.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain meetme.com designates 74.125.149.140 as permitted sender) X-PHP-List-Original-Sender: wfitch@meetme.com X-Host-Fingerprint: 74.125.149.140 na3sys009aog120.obsmtp.com Linux 2.5 (sometimes 2.4) (4) Received: from [74.125.149.140] ([74.125.149.140:47619] helo=na3sys009aog120.obsmtp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/C8-20751-679A4405 for ; Mon, 03 Sep 2012 08:58:31 -0400 Received: from mail-vc0-f170.google.com ([209.85.220.170]) (using TLSv1) by na3sys009aob120.postini.com ([74.125.148.12]) with SMTP ID DSNKUESpaWZ5L+BZNPNmNRBtQhztGY4N1GOi@postini.com; Mon, 03 Sep 2012 05:58:30 PDT Received: by vcbgb30 with SMTP id gb30so5942935vcb.29 for ; Mon, 03 Sep 2012 05:58:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=EtYV2IABDOrwt/byFJseMpCQBMSjL18cjkrljr1e9tc=; b=htUsqgFgPiFh/rMSF9vXs3P0hjqnkBAIlu7XLcfWGYN9S4S06/VYjARjIKeqshmege A7h3t4Kt4khNY0OZZtbQqzhRrEv0Me29XZiursPuVj37FGSkY/4I+9t3uuOFKdpHvg4d lK0Ezpfj9Y/Q0lISJEDwoyAgK1Ym+oXi2w57Ura2rKbsBBbMDXe4WIZxUiupWaeaYt/l KO5WqQNU4S8qfrHDzqSimGx+3awetMm9ONiRycqBOtsuUoS6g+RsPaEb7i+A0wIPR4HH VaYNAA5oRgtr6FGWOFrKgFRT/VtKHw7D4eAyTzJIKRDhdJodBBnZazFydA84oeAkIrs8 k0hg== MIME-Version: 1.0 Received: by 10.52.97.34 with SMTP id dx2mr9935157vdb.10.1346677097044; Mon, 03 Sep 2012 05:58:17 -0700 (PDT) Sender: wfitch@meetme.com Received: by 10.58.132.161 with HTTP; Mon, 3 Sep 2012 05:58:16 -0700 (PDT) X-Originating-IP: [71.185.163.243] In-Reply-To: References: <50435ABE.4010308@ajf.me> <50436412.7010802@ajf.me> <5043C3E9.2010105@ajf.me> <5043C5AF.3060701@ajf.me> <5043C74C.8020400@ajf.me> <5043D8C0.3020802@lsces.co.uk> <5044715E.3050504@rotorised.com> Date: Mon, 3 Sep 2012 08:58:16 -0400 X-Google-Sender-Auth: 0prx9B8m0uvol9dm7ftub1SdvWM Message-ID: To: Lars Strojny Cc: Pierre Joye , Ryan McCue , internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf307f346aff1c5004c8cbb1f4 X-Gm-Message-State: ALoCoQmmnfSLjPwqhKbypAAluIAI0B8rErbVFk5kaKkaMsUvC8NWJTL/Z9vCe/uu+Y4ucGa+ym48 Subject: Re: [PHP-DEV] RFC for Adding __toString to DateTime From: willfitch@php.net (Will Fitch) --20cf307f346aff1c5004c8cbb1f4 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Mon, Sep 3, 2012 at 8:09 AM, Lars Strojny wrote: > Hi Pierre, hi Will, > > Am 03.09.2012 um 13:57 schrieb Pierre Joye : > > > hi Will, > > > > On Mon, Sep 3, 2012 at 1:51 PM, Will Fitch wrote: > >> On Mon, Sep 3, 2012 at 4:59 AM, Ryan McCue wrote= : > >> > >>> As far as I can tell, there's no standard which uses the Olson databa= se > >>> to specify the timezone, so we'd have to create one. > >>> > >>> What about ISO8601 with the Olson timezone suffixed? > >>> > >>> 2012-09-02T18:17:36+0100 (Europe/London) > >>> 2012-09-02T18:19:05+0100 (Africa/Niamey) > >>> > [...] > > > > I don't think you will ever get a consensus on that. The reason is > > that this case falls in the same fall than the timezone itself (but > > per instance of an object instead of globally). > > > > I'd to suggest to force the definition of a format using the > > setStringFormat (or whatever will be the name of this function). > > __toString will then fail if no format has been set, warning and > > returns NULL (f.e.). > > > I don=92t agree here, especially if we recap what the proposed purpose of > the __toString() method was: > > Ease debugging by allowing "echo $date;" instead of "echo > $date->format(...);" > > An additional constraint to make sure users use it for debugging and > nothing else, would be: > > Not allow changing the format, neither by ini setting or any other > global means (incl. setters) > > To achieve that, we need a time format that is best for debugging, > meaning, as lossless as possible. While ISO8601 comes pretty close it > misses out on the Olson timezone suffix. I would second the notion of > creating our own format and standardizing it internally with it=92s own > constant and DateTime doing the right thing if passed to the constructor. > Additionally to what Ryan proposed, microseconds should be part of it > (which ISO allows). So, here we go: > > 2012-09-02T18:17:36.12345+0100 (Europe/London) > Hi, Lars - there wouldn't be a need for the offset if the string provides the timezone name. Parsing this wouldn't be an issue, however, it would be harder to sell this approach to others. > > Following this, the change would be fairly easy (adding a constant, a bit > parsing fu and the toString() method). > > cu, > Lars --20cf307f346aff1c5004c8cbb1f4--