← All docs

date_interval_create_from_date_string()

Creates a DateInterval from a relative date string such as "2 days".

date_interval_create_from_date_string()

function date_interval_create_from_date_string(string $datetime): mixed

Creates a DateInterval from a relative date string such as “2 days”.

Parameters:

  • $datetime (string)

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_interval_create_from_date_string is implemented in the compiler, see the internals page.