validate_date

Validation of a date which checks if the string passed is a valid date. Allowed formats

  • d-m-y 31-12-2014 separators can be a period, dash, forward slash, but not allow space
  • m-d-y 12-31-2014 separators can be a period, dash, forward slash, but not allow space
  • y-m-d 2014-12-31 separators can be a period, dash, forward slash, but not allow space
Parameters
string $value

The date string being checked

#
string $format = 'y-m-d'

The date format to be validated against. Default is y-m-d for 2014-12-31

#
Returns
bool

TRUE on success; FALSE on failure