-2

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.

bcesars
  • 1,048
  • 1
  • 17
  • 36
GeorgeB
  • 65
  • 1
  • 7

3 Answers3

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
3
$checkout = date('Y-m-d', strtotime($checkin. ' + 8 days'));
0

With DateTime()

$date = new DateTime($checkin);
$date->modify('+8 days');
echo $date->format('Y-m-d');
Rakesh Sharma
  • 13,570
  • 4
  • 35
  • 42