I need to modify the code so it will send 2 years date and not only one year.
I have tried to change to $year_from_now->add(new DateInterval('P2Y'));
but it will not work.
Please see below code:
$year_from_now=new DateTime();
$year_from_now->add(new DateInterval('P1Y'));
$dates_array = array();
foreach ( $tariffs as $beds24_room_type=>$tariff_type_dates ) {
$counter = 1;
foreach ($tariff_type_dates as $tariff_type=>$tariff_dates ) {
$odo = "p".$counter;
foreach ( $tariff_dates as $date=>$tariff_details ) {
$this_date=date_create(date("Y/m/d" , strtotime($date) ) );
$diff=date_diff($year_from_now,$this_date);
if (
(int)$diff->format("%R%a") <= 0 && // Up to one year from today
(int)$diff->format("%R%a") > -365 // Not earlier than today
) {