Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64048 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29254 invoked from network); 26 Nov 2012 12:02:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2012 12:02:55 -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:43355] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/84-26957-D6A53B05 for ; Mon, 26 Nov 2012 07:02:55 -0500 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id AE41FDE13E; Mon, 26 Nov 2012 12:02:50 +0000 (GMT) Date: Mon, 26 Nov 2012 12:02:50 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: "Ivan Enderlin @ Hoa" cc: internals@lists.php.net In-Reply-To: <50B35244.2020706@hoa-project.net> Message-ID: References: <50B34D21.4080109@hoa-project.net> <50B35244.2020706@hoa-project.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-129086861-1353931370=:10929" Subject: Re: [PHP-DEV] DateTime::modify('now') is ignored, why? From: derick@php.net (Derick Rethans) --8323329-129086861-1353931370=:10929 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 26 Nov 2012, Ivan Enderlin @ Hoa wrote: > On 26/11/12 12:25, Sebastian Krebs wrote: > > 2012/11/26 Ivan Enderlin @ Hoa > >=20 > > > I would to modify a \DateTime object to the current time, thus I wrot= e > > > this: > > >=20 > > > $d =3D new \DateTime('+1 hour'); > > > $d->modify('now'); > > >=20 > > > It did not work. Why? Because the documentation (http://php.net/datet= ime.* > > > *formats.relative ) says: = =E2=80=9CNow > > > - this is simply ignored=E2=80=9D. Really? But the behavior is pretty > > > straightforward isn't? =E2=80=9Cmodify to now=E2=80=9D means =E2=80= =9Cset to the current date and > > > time and let the timezone unchanged=E2=80=9D. > > >=20 > > It's not like "modify to something", but "modify _with_ something". Wit= h > > your point of view "modifiy('+7 days')" will _always_ point to next wee= k, > > but it should (and it's intuitive right), that it will point to 7 days > > after the previous date. So what should "modify with now" mean? > I understand the different, but then, why =E2=80=9Cnow=E2=80=9D is declar= ed in the > documentation :-) ? Because people (like you) have tried it before and found it to not do as=20 they thought :-) 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-129086861-1353931370=:10929--