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

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress