src/WellKnown/Microtime.php
public static function fromDateTime(\DateTimeInterface $date)
    {
        $str = $date->format('U') . str_pad($date->format('u'), 6, '0');
        $m = new self();
        $m->int = (int)$str;
        $m->sec = (int)substr($str, 0, 10);
        $m->usec = (int)substr($str, -6);
        return $m;
    }
public static function fromDateTime(\DateTimeInterface $date)
    {
        $str = $date->format('U') . str_pad($date->format('u'), 6, '0');
        $m = new self();
        $m->int = (int)$str;
        $m->sec = (int)substr($str, 0, 10);
        $m->usec = (int)substr($str, -6);
        return $m;
    }
public static function fromDateTime ( \ DateTimeInterface $ date ) { $ str = $ date -> format ( 'U' ) . str_pad ( $ date -> format ( 'u' ) , 6 , '0' ) ; $ m = new self ( ) ; $ m -> int = ( int ) $ str ; $ m -> sec = ( int ) substr ( $ str , 0 , 10 ) ; $ m -> usec = ( int ) substr ( $ str , - 6 ) ; return $ m ; }
Creates a new microtime from a \DateTime object using
it's timestamp and microseconds.

@param \DateTimeInterface $date

@return self
Creates a new microtime from a \ DateTime object using it s timestamp and microseconds .