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

Re: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Nikita Nefedov
On Mon, 10 Dec 2012 16:09:36 +0400, Christian Stoller stol...@leonex.de 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: ?php $date = new DateTime()

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 stol...@leonex.de 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:

RE: [PHP-DEV] Improve DateTime Class

2012-12-10 Thread Christian Stoller
-DEV] Improve DateTime Class Hi, are you mabe just looking for $date-add(new DateInterval('P15D')); ? 2012/12/10 Christian Stoller stol...@leonex.de Hi internals, what do you think about improving the modification functionality of the DateTime class. I always get a cold shiver, when I

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 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

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 is it just

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: ?php $date = new DateTime() $date-modify(‘+15 day’); In my opinion it would be nicer if one could write: $date-modify(15,