Hi!
> what do you think about improving the modification functionality of the
> DateTime class. I always get a cold shiver, when I write something like this:
> $date = new DateTime()
> $date->modify(‘+15 day’);
>
> In my opinion it would be nicer if one could write:
> $date->modify(15, DateTime
On 10/12/12 13:35, Christian Stoller wrote:
> Hm... I know '$date->add(new DateInterval('P15D'));' is possible, but it has
> the same problem.
>
> I have to write:
>
> $date = new DateTime()
> $date->add(new DateInterval('P' . getDaysToAddMethod() . 'D'));
>
> I think it is very hard to read. Or i
I agree with Christian in the sense that the readability gets compromised.
But I also think that a custom DateTime class should solve the problem
properly, since readability is not a general requirement.
My solution for that problem would be to create that extension and have
those nice methods on
It's just a matter of getting used to it IMO. I am not sure if you can
simply modify its public properties, but if that's the case, that should
handle your problem.
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/
012 1:23 PM
To: PHP internals list
Subject: Re: [PHP-DEV] Improve DateTime Class
Hi,
are you mabe just looking for
$date->add(new DateInterval('P15D'));
?
2012/12/10 Christian Stoller
> Hi internals,
>
> what do you think about improving the modification functionali
Hi,
are you mabe just looking for
$date->add(new DateInterval('P15D'));
?
2012/12/10 Christian Stoller
> Hi internals,
>
> what do you think about improving the modification functionality of the
> DateTime class. I always get a cold shiver, when I write something like
> this:
> $date = new
On Mon, 10 Dec 2012 16:09:36 +0400, Christian Stoller
wrote:
Hi internals,
what do you think about improving the modification functionality of the
DateTime class. I always get a cold shiver, when I write something like
this:
modify(‘+15 day’);
In my opinion it would be nicer if one cou
Heya,
To me, an interval is well represented by DateInterval, while the
DateTime::modify() method looks more like a shortcut to it. Do you really
need the additional functionality? Shouldn't it be easier to $date->add(new
DateInterval('P15D')); ? It is also a better representation of an interval
t