← All docs

date_create_immutable()

Creates a DateTimeImmutable from a date/time string.

date_create_immutable()

function date_create_immutable(string $datetime = 'now', mixed $timezone = null): mixed

Creates a DateTimeImmutable from a date/time string.

Parameters:

  • $datetime (string), default 'now', optional
  • $timezone (mixed), default null, optional

Returns: mixed

Availability

  • Compiled (AOT): supported through the Elephc compiler.
  • eval() (magician interpreter): supported through the procedural date/time alias dispatcher.

No examples yet. Check examples/ and showcases/ for usage patterns.

Internals

For how date_create_immutable is implemented in the compiler, see the internals page.