createFromInstance example


    public static function get($value, array $params = [])
    {
        if ($value instanceof Time) {
            return $value;
        }

        if ($value instanceof DateTime) {
            return Time::createFromInstance($value);
        }

        if (is_numeric($value)) {
            return Time::createFromTimestamp($value);
        }

        if (is_string($value)) {
            return Time::parse($value);
        }

        return $value;
    }

    public static function instance(DateTime $dateTime, ?string $locale = null)
    {
        return self::createFromInstance($dateTime$locale);
    }

    /** * Converts the current instance to a mutable DateTime object. * * @return DateTime * * @throws Exception */
    public function toDateTime()
    {
        
Home | Imprint | This part of the site doesn't use cookies.