date between two date in php
<?php
// check datebetween two dates
function chkbetweendate($chkdate='',$startdate='',$enddate=''){
$chkdate=strtotime($chkdate);
$startdate=strtotime($startdate);
$enddate=strtotime($enddate);
if($startdate <= $chkdate && $chkdate <= $enddate){
return true;
}else {
return false;
}
}
// call function here
if(chkbetweendate('2012-10-10','2012-10-5','2012-10-15')){
echo "2012-10-10 between date";
} else {
echo "2012-10-10 not in between date";
}
Comments
Post a Comment
If you Satisfied , Please Leave a comment