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);
    }