if(strtotime($date_in)==false){
echo $date_in." wtf?";
}
Output:
2012-05-12 wtf?
Why does strtotime($date_in)
return false
?
if(strtotime($date_in)==false){
echo $date_in." wtf?";
}
Output:
2012-05-12 wtf?
Why does strtotime($date_in)
return false
?
Try:
if(strtotime($date_in)===false){
echo "[$date_in] wtf?";
}
If testing for false
always use the ===
. Also wrapping the $date_in
variable with brackets help you see if there is any whitespace.
I've tried to replicate this issue, with success, but only after I changed the default timezone to:
date_default_timezone_set('Europe/Brussels');
so, perhaps you could check your ini file, or use date_timezone_get
and make sure the your settings know how to deal with the date format you're using?
Alternatively, or if the php.ini is off limits for some reason, you could look into the datetime object.