How to Add Days to Date in PHP?
This article goes into detail on how to add days to date in PHP. step by step explain how to add days to the current date in PHP. it's a simple example of how to add 7 days to date in PHP. This article goes into detail on how to add 30 days to date in PHP. Alright, let’s dive into the steps.
I will give you very simple example how to add days to date in PHP. so let's see both example with output:
Example 1: PHP Add Days to Date
index.php
<?php
$date = "2021-11-01";
$newDate = date('Y-m-d', strtotime($date. ' + 3 days'));
echo $newDate;
?>
Output:
2021-11-04
Example 2: PHP Add Days to Current Date
index.php
<?php
$newDate = date('Y-m-d', strtotime(' + 3 days'));
echo $newDate;
?>
Output:
2021-11-06
i hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Extract All Email Addresses from String in PHP?
- How to get HTML Tag Attribute Value in PHP?
- Moment JS Get Year from Date Example
- JQuery Moment Get Current Date Example
- Laravel Carbon Check Date is in Past Date Code
- How to Change Date Format in PHP?
- PHP MySQL Column Sorting Example Tutorial
- PHP Check Word Exist in String or Not Example
- How to Find Day Name from Specific Date in PHP?