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

(04-07-2019, 08:43 AM)skunkbad Wrote: 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 {
    
//...


SOLVED. THANK YOU FOR HELPING
Reply


Messages In This Thread
RE: Comparison Operators >= in Control Structures why false? - by DELE - 04-09-2019, 09:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB