Re: [PHP] Casting from parent class to child

2010-10-08 Thread Andrew Ballard
On Fri, Oct 8, 2010 at 12:50 PM, Nathan Rixham wrote: > David Harkness wrote: >> >> Casting does not change an object. You must copy the relevant value(s) >> from >> the object returned into a new DateTimePlus. Since DateTime's constructor >> takes only a string, and I assume it won't accept your

Re: [PHP] Casting from parent class to child

2010-10-08 Thread Nathan Rixham
David Harkness wrote: Casting does not change an object. You must copy the relevant value(s) from the object returned into a new DateTimePlus. Since DateTime's constructor takes only a string, and I assume it won't accept your format directly, unless you implement __toString I believe (not test

Re: [PHP] Casting from parent class to child

2010-10-06 Thread David Harkness
Casting does not change an object. You must copy the relevant value(s) from the object returned into a new DateTimePlus. Since DateTime's constructor takes only a string, and I assume it won't accept your format directly, you're better off converting the string into a Unix timestamp and creating a