I'm trying this one out and it's been a while since I last coded in PHP.
I have a function that checks if given date is in between the range of dates:
pr($this->isDateBetween("2014-11-15", "2014-12-05", "2014-06-14"));
public function isDateBetween($dt_start, $dt_check, $dt_end){
if(strtotime($dt_check) >= strtotime($dt_start) && strtotime($dt_check) <= strtotime($dt_end)){
return true;
} else{
return false;
}
}
But seems like I'm getting false
. The expected result should be true
because 2014-12-05
is less than 2014-06-14
.
December is less than June so that should be true?
Also,
When I change 2014-06-14
to 2014-12-14
it became true.
Sorry, I'm not updated anymore with PHP. Please bear with me.
EDITS
Tried converting those to strtotime but still getting wrong results