Skip to content

Instantly share code, notes, and snippets.

@MartinTale
Created December 17, 2019 15:44
Show Gist options
  • Save MartinTale/636c226d0fac5366daac87f720bac97c to your computer and use it in GitHub Desktop.
Save MartinTale/636c226d0fac5366daac87f720bac97c to your computer and use it in GitHub Desktop.
PHP functions that validates that the given string is a date..
<?php
if (! function_exists('isDate'))
{
function isDate($string)
{
if (DateTime::createFromFormat('Y-m-d', trim($string)) !== FALSE) {
return true;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment