Validating date server side in php
Use of the date rule requires that a valid format attribute also be included for the field.The format is used to both validate and format the input. The pattern can be given as a named pattern or as a Perl compatible regular expression.Since this is an item of type "numeric," it is automatically validated as a number.The validate rules "required:max=4:min=0" specify that the element is required and must be between 0 and 4. However, if multiple rules are applied to an element, the validation process will throw a warning on the first violation and stop processing that element.Many common patterns will be provided by name and developers can supply any pattern they can create.The pattern validation rule serves two purposes, the first is to validate if the data matches a specified pattern.In some cases, such as the telephone number, it does not make sense to specify a mask without a pattern, but you may want to specify a pattern without a mask.
Causes any date entered in the specified field to be validated as a valid date (date, time and date/time are supported).The second is to manipulate that data so it matches a specific pattern.For example, consider a typical American style telephone number.A pattern validation rule will insure the telephone number is one of the acceptable patterns while an input mask will make it look correct.The implementation of pattern matching and input masks are combined in one validation rule because they are intricately tied together.