Calculate the difference between two dates:
The date_diff() function returns the difference between two DateTime objects.
| Parameter | Description |
|---|---|
| datetime1 | Required. Specifies a DateTime object |
| datetime2 | Required. Specifies a DateTime object |
| absolute | Optional. Specifies a Boolean value. TRUE indicates that the interval/difference MUST be positive. Default is FALSE |
| Return Value: | Returns a DateInterval object on success that represents the difference between the two dates. FALSE on failure |
|---|---|
| PHP Version: | 5.3+ |
PHP Date/Time Reference
Your message has been sent to W3Schools.