strtotime(" ")
doesn't return false when I provide string containing just space or any other character.
Are there any less code solutions to make it return false?
I can't use preg_match
, because date formats are all different depending on locale of each user.
http://php.net/manual/en/function.strtotime.php
Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure.
Edit: I need to validate the date string, not to trim spaces or other user-provided characters.