may be this question had been asked, I’ve searched but still not confident about my problem..
my problem is checking valid date from string
$a='23-June-11'; //valid
$b='Normal String';//invalid
I want to convert $a and $b using strtotime()
before I do that, of course i want to validate whether $a or $b is a valid date format
From $a i can get 23, 11 using explode function, but how about ‘June’?
using function above, ‘June’ is not numeric
Why not let
strtotime()do the validation?It will return
falseif it’s an invalid date.Otherwise, you’d have to rebuild
strtotime()‘s functionality in order to do the validation – sounds like a futile (and big) exercise to me.