1<?php
2// PHP program to add days to $Date
3
4// Declare a date
5$date = "2019-05-10";
6
7// Add days to date and display it
8echo date('Y-m-d', strtotime($date. ' + 10 days'));
9
10?>
1$date = "Mar 03, 2011";
2$date = strtotime($date);
3$date = strtotime("+7 day", $date);
4echo date('M d, Y', $date);
1$start_date = "2015/03/02";
2$date = strtotime($start_date);
3$date = strtotime("+7 day", $date);
4echo date('Y/m/d', $date);
5
1<?php
2 // adding extra days to date
3
4 // Steps:
5 // 1) using carbon
6 // 2) using strtotime
7
8 //Step 1
9 $date = date('Y M d h:i:s') // 2020 09 22 22:09:26 UTC
10
11 $new_date = Carbon::parse($date->addDays(1); // adds extra day
12
13 // Step 2
14 $date = date('Y M d h:i:s') // 2020 09 22 22:09:26 UTC
15
16 echo $new_date = date('Y M d h:i:s', strtotime($date. '+1 day'));
17?>
1$date = new DateTime('2020-11-24');
2$date->add(new DateInterval("P9D"));
3
4echo $date->format('Y-m-d');