Easy Tutorial
❮ Func Filesystem Parse Ini File Func Ftp Nb Continue ❯

PHP date_diff() Function

PHP Date/Time Reference Manual

Example

Calculate the difference between two dates:


Definition and Usage

The date_diff() function returns the difference between two DateTime objects.

Syntax

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.

Technical Details

Return Value: Returns a DateInterval object representing the difference between two dates if successful. Returns FALSE if failed.
PHP Version: 5.3+
--- ---
❮ Func Filesystem Parse Ini File Func Ftp Nb Continue ❯