I am receiving the variable $CheckIn
$CheckIn
is a date in Y-m-d format, how can i create a $Checkout
variable with the value +8 days after checkin.
Asked
Active
Viewed 2,645 times
-2
-
3http://php.net/manual/en/class.datetime.php – Jeremiah Winsley Jan 27 '15 at 12:50
-
Show your code to us – Manwal Jan 27 '15 at 12:51
-
Looks like a duplicate of : http://stackoverflow.com/questions/3727615/adding-days-to-date-in-php – CD001 Jan 27 '15 at 13:00
3 Answers
3
Try this:
$Date = "2010-09-17";
echo date('Y-m-d', strtotime($Date. ' + 8 days'));//save this in any variable

Manwal
- 23,450
- 12
- 63
- 93
0
With DateTime()
$date = new DateTime($checkin);
$date->modify('+8 days');
echo $date->format('Y-m-d');

Rakesh Sharma
- 13,680
- 5
- 37
- 44