Search Results

  1. Returns new DateTimeImmutable instance encapsulating the given DateTime object

  2. Feb 17, 2021 · The DateTimeImmutable::createFromMutable () function is an inbuilt function in PHP which is used to return the new DateTimeImmutable object encapsulating the given DateTime object.

  3. Once created, a DateTimeImmutable object cannot be modified. This is great as immutable state should be favored over mutable state. Ever since its introduction, the DateTimeImmutable provides the createFromMutable () method to create a DateTimeImmutable object based on an existing DateTime object:

  4. The mutable DateTime object that you want to convert to an immutable version. This object is not modified, but instead a new DateTimeImmutable object is created containing the same date time and timezone information.

  5. The immutable DateTimeImmutable object that needs to be converted to a mutable version. This object is not modified, but instead a new DateTime instance is created containing the same date, time, and timezone information.

  6. The createFromImmutable method creates a mutable DateTime object from an immutable DateTimeImmutable object. Let's explore its operation with examples.

  7. DateTimeImmutable::createFromMutable — Returns new DateTimeImmutable instance encapsulating the given DateTime object DateTimeImmutable::getLastErrors — Returns the warnings and errors