# DateTime::__unserialize

# DateTimeImmutable::__unserialize

# DateTimeInterface::__unserialize

(PHP 8 >= 8.2.0)

DateTime::__unserialize -- DateTimeImmutable::__unserialize -- DateTimeInterface::__unserialize — Unserialize an Datetime

### Description

public DateTime::__unserialize(array `$data`): void
public DateTimeImmutable::__unserialize(array `$data`): void
public DateTimeInterface::__unserialize(array `$data`): void

Le gestionnaire __unserialize().

### Liste de paramètres

`data`

  The serialized DateTime.

### Valeurs de retour

L'objet DateTime.

### Exemples

Exemple #1 Exemple de DateTime::unserialize()

`<?php
$serializedDate = 'O:8:"DateTime":3:{s:4:"date";s:26:"2025-03-27 00:00:00.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}';
var_dump(unserialize($serializedDate));
?>`

Les exemples ci-dessus vont afficher :

    object(DateTime)#1 (3) {
      ["date"]=>
      string(26) "2025-03-27 00:00:00.000000"
      ["timezone_type"]=>
      int(3)
      ["timezone"]=>
      string(3) "UTC"
    }

### Voir aussi

- DateTime::__serialize() - Désérialise un DateTime