Func Date Date Sub
## Complete PHP Date Reference
(/php/php-ref-date.html)
## Definition and Usage
The date_sub() function subtracts some days, months, years, hours, minutes and seconds from a date.
## Syntax
```php
date_sub(object $object, interval $interval): DateTime|false
```
## Parameters
| Parameter | Description |
|-----------|-------------|
| object | Required. Specifies a valid DateTime object. |
| interval | Required. Specifies a valid DateInterval object. |
## Technical Details
| Return Value: | If successful, returns the modified DateTime object for the date. If it fails, returns FALSE. |
| PHP Version: | PHP 5.3.0+ |
| Changelog: | As of PHP 5.2.1, date_modify() calls internally date_add() function, which adds/subtracts the time interval. |
## More Examples
**Example 1**
Subtract 5 days from a date:
```php
```
Output:
```
2013-04-26
```
**Example 2**
Subtract 2 months from a date:
```php
```
Output:
```
2013-03-01
```
**Example 3**
Subtract 1 year and 3 months from a date:
```php
```
Output:
```
2012-02-01
```
## See Also
- [PHP date_add() Function](/php/func-date-date-add.html) - Add some days, months, years, hours, minutes and seconds to a date.
## Color Picker
(/colors/color-picker.php "Color Picker")
## Top Tutorials
(/html/html-tutorial.html)
(/css/css-tutorial.html)
(/js/js-tutorial.html)
(/sql/sql-tutorial.html)
(/python3/python3-tutorial.html)
(/bootstrap/bootstrap-tutorial.html)
(/bootstrap4/bootstrap4-tutorial.html)
(/bootstrap5/bootstrap5-tutorial.html)
(/linux/linux-tutorial.html)
(/vue3/vue3-tutorial.html)
(/react/react-tutorial.html)
(/jupyter/jupyter-tutorial.html)
## Top Reference
(/tags/)
(/ref/css-reference.html)
(/jsref/)
(/sql/sql-reference.html)
(/python3/python3-ref.html)
(/php/php-ref.html)
(/mysql/mysql-ref-select.html)
(/colors/colorslator.html)
## W3Cschool Tutorial
YouTip