Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66074 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89041 invoked from network); 20 Feb 2013 20:05:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2013 20:05:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wg0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:54293] helo=mail-wg0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/A0-20257-37C25215 for ; Wed, 20 Feb 2013 15:05:08 -0500 Received: by mail-wg0-f47.google.com with SMTP id dr13so6619643wgb.2 for ; Wed, 20 Feb 2013 12:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Dzo2IBvs/VwmgqArwbgXLYccG7kQAcFqZDupfppd3yE=; b=sYAD12UWrZC5NQ+UnQPuAJsgVctp2hmUGQBiJNT0WS8y4Ybcyg2qVFLCuIqpWRMErn PooWW8TKkwdCCU1byXCydjMpojuBwsEnIYeXKbfjI0n5BMLMT/wE+n6PSfUqDW0XQ2Pp RraPWtjNGEdwXOkhC4Escp3ao8Yh6Wuujgpl2zPGzWh4Tf5Ec2Q9AdlRdRTxFdPSPY+7 HsqouIC7x0LOETicq60Yh/grUsLq3muOoar6jF+WDUZS4mofuxu9bLRle5lVPnRe2gyl YMS0tHL/pSzG0xb8F2B6blFsES6kktIVxJQJXD+NPrdPZK3oWG/Ycwpbm16M2nCTOw1n S0Ew== MIME-Version: 1.0 X-Received: by 10.194.88.202 with SMTP id bi10mr36618944wjb.5.1361390705434; Wed, 20 Feb 2013 12:05:05 -0800 (PST) Received: by 10.194.177.138 with HTTP; Wed, 20 Feb 2013 12:05:05 -0800 (PST) In-Reply-To: References: <5122F37F.2030706@sugarcrm.com> Date: Wed, 20 Feb 2013 12:05:05 -0800 Message-ID: To: David Soria Parra Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=089e0102ee2265e0b104d62d793b Subject: Re: [PHP-DEV] Getting separate outputs with Date Functions From: kris.craig@gmail.com (Kris Craig) --089e0102ee2265e0b104d62d793b Content-Type: text/plain; charset=ISO-8859-1 On Wed, Feb 20, 2013 at 11:54 AM, David Soria Parra wrote: > On 2013-02-19, Stas Malyshev wrote: > > Hi! > > > >> echo date_create('@1361240634')->format('Y-m-d'); > >> // output: 2013-02-19 > >> > >> echo date('Y-m-d',1361240634); > >> // output: 2013-02-18 > > > > timestamp dates are created with UTC TZ, date() assumes your configured > TZ. > > I ran into this myself and I personally consider date() assuming your > configured TZ A bug. Timestamps are defined as UTC and the behaviour of > DateTime is correct there, that it always assume UTC. date() should do > the same. But then date() behaviour has been that way since ages > and probably a lot of code out there is assuming the current TZ when > using date(). > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I'm not sure if I would go so far as to call it a bug, since that is the intended behavior and developers tend to rely on that. However, the inconsistent behavior between how date() and DateTime factor timezones should at least be documented if it isn't already. What if we added an optional argument to date() that would allow the developer to specify a timezone, including UTC? The default behavior would be the same as it is now, so there wouldn't be any BC breakage. Thoughts? --Kris --089e0102ee2265e0b104d62d793b--