public static function fromString($time)
    {
        try {
            $date = new \DateTime($time);
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(sprintf('Invalid time "%s".', $time));
        }

        return self::fromDate($date);
    }
public static function fromString($time)
    {
        try {
            $date = new \DateTime($time);
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(sprintf('Invalid time "%s".', $time));
        }

        return self::fromDate($date);
    }
public static function fromString ( $ time ) { try { $ date = new \ DateTime ( $ time ) ; } catch ( \ Exception $ e ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid time "%s".' , $ time ) ) ; } return self :: fromDate ( $ date ) ; }
Creates a new time from a string.

@param string $time

@return Time

@throws \InvalidArgumentException If the passed time is invalid
Creates a new time from a string .