Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64045 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23471 invoked from network); 26 Nov 2012 11:25:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2012 11:25:52 -0000 Authentication-Results: pb1.pair.com header.from=sebastian.krebs.berlin@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.42 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.83.42 mail-ee0-f42.google.com Received: from [74.125.83.42] ([74.125.83.42:43665] helo=mail-ee0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/73-26957-DB153B05 for ; Mon, 26 Nov 2012 06:25:50 -0500 Received: by mail-ee0-f42.google.com with SMTP id t10so6641777eei.29 for ; Mon, 26 Nov 2012 03:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:x-google-sender-delegation:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=KTldMmBFyKEagnCNxiFuHjyAEzgAxi7OAN+qJl5zAPs=; b=qHMLGZ35KNfMoGPDE4R2dEQHSjcCHeZ9HtJlJ85Vex+p640M9vrrU+90oKqK1VA3RN 4jmUvWRH/OppAvlHORnaV92msgo6VnX0TK7CNQYnhRiyIbCrFM8VxfW2Nd3sNzX8Fr7S Cs3ewh+bwhvUzigsbY014CD59+q1PXZNbHOZVouCEoBpsd9ZnomBz80c7oeYM1Iiazvy qTEENDaqImn86hr9sF5PM96OAVCVarRqMLrWV2ikODTFFZ+fgzn66xbJqaQeW1EEMweI tV31rWpr8qvq5NYZaXGQjAHACVzHfxEvFdXd44MFxQV54Rl9u/6KTJKN9jgJXT9qzB+v J4JQ== MIME-Version: 1.0 Received: by 10.14.200.194 with SMTP id z42mr44523109een.13.1353929147265; Mon, 26 Nov 2012 03:25:47 -0800 (PST) Sender: sebastian.krebs.berlin@gmail.com X-Google-Sender-Delegation: sebastian.krebs.berlin@gmail.com Received: by 10.14.207.67 with HTTP; Mon, 26 Nov 2012 03:25:47 -0800 (PST) In-Reply-To: <50B34D21.4080109@hoa-project.net> References: <50B34D21.4080109@hoa-project.net> Date: Mon, 26 Nov 2012 12:25:47 +0100 X-Google-Sender-Auth: 9Hqz8FsotHjVJUc56KJopo40RP4 Message-ID: To: PHP internals list Content-Type: multipart/alternative; boundary=047d7b3440c6dfb25304cf64313a Subject: Re: [PHP-DEV] DateTime::modify('now') is ignored, why? From: krebs.seb@gmail.com (Sebastian Krebs) --047d7b3440c6dfb25304cf64313a Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 2012/11/26 Ivan Enderlin @ Hoa > Hi internals, > > I would to modify a \DateTime object to the current time, thus I wrote > this: > > $d =3D new \DateTime('+1 hour'); > $d->modify('now'); > > It did not work. Why? Because the documentation (http://php.net/datetime.= * > *formats.relative ) says: =93No= w > - this is simply ignored=94. Really? But the behavior is pretty > straightforward isn't? =93modify to now=94 means =93set to the current da= te and > time and let the timezone unchanged=94. > It's not like "modify to something", but "modify _with_ something". With your point of view "modifiy('+7 days')" will _always_ point to next week, 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? Other way round: You are looking for the "set*()"-methods :) Because you want to _set_ a date, not modify one. Regards, Sebastian > Thoughts? > Best regards. > > -- > Ivan Enderlin > Developer of Hoa > http://hoa.42/ or http://hoa-project.net/ > > PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) > http://disc.univ-fcomte.fr/ and http://www.inria.fr/ > > Member of HTML and WebApps Working Group of W3C > http://w3.org/ > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 github.com/KingCrunch --047d7b3440c6dfb25304cf64313a--