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,622 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
- 22,994
- 11
- 59
- 91
0
With DateTime()
$date = new DateTime($checkin);
$date->modify('+8 days');
echo $date->format('Y-m-d');
Rakesh Sharma
- 13,570
- 4
- 35
- 42