Extending DateInterval() as a class object

43 Views Asked by At

I'm trying to migrate some code from Pear Date_span to php and so want to create a class which returns a DateInterval object with zero date and time. I need a class so that I can code a number of methods to the class. However I cannot seem to get this to work. I admit that I am a little new to php, so forgive me. Can someone point me in the right direction please.

class myDateSpan {
    public function __construct() {
        return DateInterval::createFromDateString('0 day');
    }

    public function getClock() {
        return $this->format('H:i:s');
    }
}
0

There are 0 best solutions below