Skip to content

Instantly share code, notes, and snippets.

@makeusabrew
Created January 26, 2011 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makeusabrew/796449 to your computer and use it in GitHub Desktop.
Save makeusabrew/796449 to your computer and use it in GitHub Desktop.
php date validation issues
<?php
/**
@see http://www.php.net/manual/en/datetime.createfromformat.php for clarification as to what 'Y-m-d'
should be and what we'd expect this to return
*/
$date = DateTime::createFromFormat("Y-m-d", "10-01-01");
if ($date !== false) {
echo "PHP is mildly retarded";
} else {
echo "PHP respects its own formatting rules perfectly";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment