Casting from parent class to child

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm trying to extends the base class DateTime.
parent::createFromFormat("H.i d.m.Y", $string); returns a DateTime and I
want to convert it into a DateTimePlus (my own extended class). What's the
best way to do this plz ?

Some code:
class DateTimePlus extends DateTime

{
        static function setFromGUIDateAndTime($date,$time ){

        $string = $time.' '.$date;
        //echo 'str:'.$string;
        $res = parent::createFromFormat("H.i d.m.Y", $string);
        return (DateTimePlus)parent::createFromFormat("H.i d.m.Y", $string);

    }


Thk you

matt

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux