Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Stas Malyshev
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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Ángel González
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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Daniel Ribeiro Gomes
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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Marco Pivetta
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/

RE: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Christian Stoller
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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Sebastian Krebs
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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Nikita Nefedov
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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Marco Pivetta
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

[PHP-DEV] Improve DateTime Class

2012-12-10 Thread 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: modify(‘+15 day’); In my opinion it would be nicer if one could write: $date->modify(15, DateTime::INTERVAL_DAY); // for adding 15 d