Menu Home

date_interval_create_from_date_string

osbo.com | PHP | Functions | date_interval_create_from_date_string

Sets up a DateInterval from the relative parts of the string

Syntax

date_interval_create_from_date_string ( string $datetime ) : DateInterval

Parameters

datetime

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

Returns a new DateInterval instance.

Examples

1

1

2

2021-04-10 22:19:35
2021-04-10 22:19:36
2021-04-10 22:20:35
2021-04-10 23:19:35
2021-04-11 22:19:35
2021-04-17 22:19:35
2021-05-10 22:19:35
2022-04-10 22:19:35

PHP