public static function create($datepoint): self
    {
        if ($datepoint instanceof DateTimeInterface) {
            return new self($datepoint->format('Y-m-d H:i:s.u'), $datepoint->getTimezone());
        }

        if (false !== ($timestamp = filter_var($datepoint, FILTER_VALIDATE_INT))) {
            return new self('@'.$timestamp);
        }

        return new self($datepoint);
    }
public static function create($datepoint): self
    {
        if ($datepoint instanceof DateTimeInterface) {
            return new self($datepoint->format('Y-m-d H:i:s.u'), $datepoint->getTimezone());
        }

        if (false !== ($timestamp = filter_var($datepoint, FILTER_VALIDATE_INT))) {
            return new self('@'.$timestamp);
        }

        return new self($datepoint);
    }
public static function create ( $ datepoint ) : self { if ( $ datepoint instanceof DateTimeInterface ) { return new self ( $ datepoint -> format ( 'Y-m-d H:i:s.u' ) , $ datepoint -> getTimezone ( ) ) ; } if ( false !== ( $ timestamp = filter_var ( $ datepoint , FILTER_VALIDATE_INT ) ) ) { return new self ( '@' . $ timestamp ) ; } return new self ( $ datepoint ) ; }
Returns a position in time expressed as a DateTimeImmutable object.

A datepoint can be
<ul>
<li>a DateTimeInterface object
<li>a integer interpreted as a timestamp
<li>a string parsable by DateTime::__construct
</ul>

@param mixed $datepoint a position in time
Returns a position in time expressed as a DateTimeImmutable object .