Answers for "php check if month contained in date range"

PHP
1

check if date is within range php

$start_date = '2020-10-21';
$end_date = '2020-10-15';
$date_check = '2020-08-28';

if ($this->check_in_range($start_date, $end_date, $date_from_user)) {
  echo "within range";
} else {
  echo "not within range";
}

function check_in_range($start_date, $end_date, $date_from_user) {
  // Convert to timestamp
  $start = strtotime($start_date);
  $end = strtotime($end_date);
  $check = strtotime($date_from_user);

  // Check that user date is between start & end
  return (($start <= $check ) && ($check <= $end));
}
Posted by: Guest on October-21-2020
0

php check if day in month

// function
cal_days_in_month(calendar,month,year);
//e.g.
$d=cal_days_in_month(CAL_GREGORIAN,10,2005);
echo "There was $d days in October 2005";
Posted by: Guest on August-05-2020

Code answers related to "php check if month contained in date range"

Browse Popular Code Answers by Language