-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,016
  • 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
  • 23,450
  • 12
  • 63
  • 93
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,680
  • 5
  • 37
  • 44