Creates an instance from a Unix timestamp

# DateTimeImmutable::createFromTimestamp

(PHP 8 >= 8.4.0)

DateTimeImmutable::createFromTimestamp — Creates an instance from a Unix timestamp

### Beschreibung

public static function DateTimeImmutable::createFromTimestamp(int|float `$timestamp`): static

Creates an instance from a Unix timestamp.

### Parameter-Liste

`timestamp`
  Unix timestamp representing the date. A Float value is also accepted which allows for microsecond precision.

### Rückgabewerte

Returns a new DateTimeImmutable instance.

### Fehler/Exceptions

If the `timestamp` is outside the range [`PHP_INT_MIN`, `PHP_INT_MAX`], a DateRangeError is thrown.

### Beispiele

Beispiel #1 DateTimeImmutable::createFromTimestamp() example

    <?php
    $date = DateTimeImmutable::createFromTimestamp(123.456789);
    echo $date->format('Y-m-d H:i:s.u');
    ?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    1970-01-01 00:02:03.456789

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open