Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64051 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35502 invoked from network); 26 Nov 2012 12:50:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2012 12:50:04 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; 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:39943] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/A5-26957-B7563B05 for ; Mon, 26 Nov 2012 07:50:03 -0500 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id 737DFDE13E; Mon, 26 Nov 2012 12:50:00 +0000 (GMT) Date: Mon, 26 Nov 2012 12:50:00 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Nikita Nefedov cc: "internals@lists.php.net" In-Reply-To: Message-ID: References: <50B34D21.4080109@hoa-project.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1742368618-1353934200=:10929" Subject: Re: [PHP-DEV] DateTime::modify('now') is ignored, why? From: derick@php.net (Derick Rethans) --8323329-1742368618-1353934200=:10929 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 26 Nov 2012, Nikita Nefedov wrote: > On Mon, 26 Nov 2012 15:06:09 +0400, Ivan Enderlin @ Hoa > wrote: >=20 > > I would to modify a \DateTime object to the current time, thus I=20 > > wrote this: > >=20 > > $d =3D new \DateTime('+1 hour'); > > $d->modify('now'); > >=20 > > It did not work. Why? Because the documentation=20 > > (http://php.net/datetime.formats.relative) says: =E2=80=9CNow - this is= =20 > > simply ignored=E2=80=9D. Really? But the behavior is pretty straightfor= ward=20 > > isn't? =E2=80=9Cmodify to now=E2=80=9D means =E2=80=9Cset to the curren= t date and time and=20 > > let the timezone unchanged=E2=80=9D. >=20 > Shouldn't DateTime be immutable? What's the point of DateTime object=20 > being mutable? I would include my point about why DateTime should be=20 > immutable but I even can't come with any points except OO-logic and=20 > all I can say is I just feel like mutable DateTime is wrong. What you=20 > think about it? Yes, it should have been immutable. Biggest mistake that I made in this=20 API. We can't change it anymore though. cheers, Derick --=20 http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug Posted with an email client that doesn't mangle email: alpine --8323329-1742368618-1353934200=:10929--