PHP 5 >= 5.3.0, PHP 7, PHP 8
DateInterval::createFromDateString - Sets up a DateInterval from the relative parts of the string
Code Examples

DateInterval::createFromDateString( string$datetime ): public static DateInterval|false

Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string.



A date with relative parts. Specifically, the relative formats supported by the parser used for strtotime and DateTime will be used to construct the DateInterval.

Return Values

Returns a new DateInterval instance on success, or false on failure.

Example of DateInterval::createFromDateString

Show all examples for DateInterval::createFromDateString

PHP Version:

Function DateInterval::createFromDateString:

Date and Time Functions

Most used PHP functions