clonefish logo

date format validation YYYY-MM-DD MM-DD-YYYY DD/MM/YYYY

date validation

The key to date validation is the format string. To create a format string, use the following date and/or time elements combined with some delimiter characters. The date/time elements are: Using these elements you can build most of the numeric date formats used in the world. You can use any kind of delimiters in the format string.

The input is validated syntactically first (number of digits must be correct), then comes the validation against the following rules (if the element exists):

Furthermore, you can specify whether the date is required or not: not required date fields may be empty.

Possible parameters:
'validation' => Array(
  Array( 
    'type'    => 'date',
    'required' => 0 | 1,
    'format'  => formatstring
  )
)