Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62718 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30184 invoked from network); 3 Sep 2012 09:45:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 09:45:49 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:33910] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/E1-20751-C4C74405 for ; Mon, 03 Sep 2012 05:45:49 -0400 Received: by obbwc18 with SMTP id wc18so9619533obb.29 for ; Mon, 03 Sep 2012 02:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=aivGACtTvEh81yYsHMBPhqe97QXQ111gyOVMBmofDrg=; b=TyPAmh4hgwYkMNdjPpQz3Nc1snWysqMFSKHKJ3EfjpVMHDSTYeeXmoVFZBU2pzS6jb FYdJEepqxgZ54gbV7KRecM442qi3XxFMbHyqxmbP5sGHwUJcUN2GVKCYYjFqRjdCzq0E RuB+ysAQqKy6tMP4S9i512vm/rsenQecutmPQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=aivGACtTvEh81yYsHMBPhqe97QXQ111gyOVMBmofDrg=; b=j86kZcHpOIDcuuiMScGEygQZ3d2hj+PRAyR3BazBXKk7MiEF8EtY9wcjB4JuohPytc WNrDYnO5ErX5gQm42WA6irEXIzZ/o0WmvGY8PMKYyGL0hHGLbJWMiDFy1vEAzH+w1gWA sw5mhioAkyaET0/uhGezrLgUO12PzPUv1wfsn4Q4w8IuyWQE8gPi6EhupoGg2u1PpuIs 6qWRaOE1SnT+fJKfF6bzFSk0CovclPCBi2bx7ZZd09tQCrZfWdBQCBjCU22nWcDGdguD 06dltWdCjkE04TqEZtXQYFSxDi+nxNyDYT1IRbADwoQlTGA5n7xzIlufdbUixkOSaHTh vlqg== Received: by 10.60.12.234 with SMTP id b10mr13887382oec.72.1346665545845; Mon, 03 Sep 2012 02:45:45 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.76.171.131 with HTTP; Mon, 3 Sep 2012 02:45:25 -0700 (PDT) In-Reply-To: <88183ff3-8037-44da-b6f9-975739600cc8@email.android.com> 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> <88183ff3-8037-44da-b6f9-975739600cc8@email.android.com> Date: Mon, 3 Sep 2012 17:45:25 +0800 X-Google-Sender-Auth: Axnvn1tt4UpUBPRUHZVTswT8yzQ Message-ID: To: Andrew Faulds Cc: Ryan McCue , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQnavxG0/ERHfs+tPZB0/sQ3gMWxPTU9dB9YYwMok1VVYQ2dnvgWp5VKQjnr32FedsvOlY6F Subject: Re: [PHP-DEV] RFC for Adding __toString to DateTime From: aharvey@php.net (Adam Harvey) On 3 September 2012 17:36, Andrew Faulds wrote: > Ryan McCue wrote: >>What about ISO8601 with the Olson timezone suffixed? >> >> 2012-09-02T18:17:36+0100 (Europe/London) >> 2012-09-02T18:19:05+0100 (Africa/Niamey) >> > > Sounds good. If we're going to invent arbitrary non-standard formats, why don't we just tell people to use json_encode($dateTime) and be done with it? I just don't see how we can choose a sensible default format for users. Sometimes you want ISO 8601. Sometimes you want whatever your locale's customary date format is. Sometimes you want US m/d/y dates for interacting with legacy systems. RFC 2822. RFC 822, natch. And so on. I don't see why one format should be blessed over others and have magic behaviour when a DateTime object is cast to a string. IMO, the fact that users have to provide a format string and call format() is a good thing: explicit beats implicit, every day of the week. No matter what format string you use to iterate over said days. Adam