Check if variable is a valid date with PHP
I am working on a script that will import some data from a CSV file. As I am doing this I want to be able to check a variable to see if it is a valid date string. I have seen several ways to check if a sting is a date, but most of them require you to now the format. I will not know the format that the date will in. right now I am using strtotime(), but this fails to easily $field ="May"; if(strtotime($field)){ echo "This is a date"; } In this case, "May" was the persons first name, and not a date at all. Can any one recommend more reliable function? Edit based on questions from some of you.