Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64047 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26154 invoked from network); 26 Nov 2012 11:28:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2012 11:28:09 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:60563] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/14-26957-84253B05 for ; Mon, 26 Nov 2012 06:28:08 -0500 Received: from Hwhost2.local (107-178.203-62.cust.bluewin.ch [62.203.178.107]) by host1.trois-doubles.net (Postfix) with ESMTPSA id DFC97201095 for ; Mon, 26 Nov 2012 12:28:04 +0100 (CET) Message-ID: <50B35244.2020706@hoa-project.net> Date: Mon, 26 Nov 2012 12:28:04 +0100 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/19.0 Thunderbird/19.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: <50B34D21.4080109@hoa-project.net> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] DateTime::modify('now') is ignored, why? From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hi Sebastien, On 26/11/12 12:25, Sebastian Krebs wrote: > 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/dateti= me.* >> *formats.relative ) says: =93= Now >> - this is simply ignored=94. Really? But the behavior is pretty >> straightforward isn't? =93modify to now=94 means =93set to the current= date and >> time and let the timezone unchanged=94. >> > 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 =93now=94 is declared in the=20 documentation :-) ? > > Other way round: You are looking for the "set*()"-methods :) Because yo= u > want to _set_ a date, not modify one. Exactly, setTimestamp(time()) resolved by problem. Best regards. --=20 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/