Welcome Guest, Not a member yet? Register   Sign In
Comparison Operators >= in Control Structures why false?
#4

PHP has no way of knowing that your dates are dates. There are a number of ways you could handle it, but the simplest would be to wrap your dates in strtotime()


PHP Code:
$date  '2019-04-07';

$date1 '2019-04-01';
$date2 '2019-04-15';
$date3 '2019-04-16';
$date4 '2019-04-30';

if( 
    
strtotime($date) >= strtotime($date1) && 
    
strtotime($date) <= strtotime($date2
){
    
//...
} else {
    
//...

Reply


Messages In This Thread
RE: Comparison Operators >= in Control Structures why false? - by skunkbad - 04-07-2019, 08:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB