PHP date_sub() Function
PHP Date/Time Reference Manual
Example
Subtract 40 days from March 15, 2013:
Run Example »
Definition and Usage
The date_sub() function subtracts days, months, years, hours, minutes, and seconds from a specified date.
Syntax
date_sub(
object,interval);
| Parameters | Description |
|---|---|
| object | Required. Specifies a DateTime object returned by date_create() DateTime object returned by |
| interval | Required. Specifies a DateInterval object. |
Technical Details
| Return Value: | Returns a DateTime object on success, or FALSE on failure. |
|---|---|
| PHP Version: | 5.3+ |
PHP Date/Time Reference Manual