The year limitation would be used if you were asking for a date of birth or date of some recent event.
: # group without capture # that match 31st of month 1,3,5,7,8,10,12 (? # number 0 optionnal  # one digit either 1,3,5,7 or 8 ) # end group | # alternative (1) # 1 followed by 0,1 or 2 ) # end group - # dash (19|20)?
In this example, the date fields will only accept input that matches the pattern 'dd/mm/yyyy' (this could just as easily be changed to 'yyyy-mm-dd' or 'mm/dd/yyyy').
The time field will allow input starting with 'hh:mm' following by an optional 'am' or 'pm'. The code behind the form is as follows: For each field in the form (first the dates, then the time field), a check is made as to whether the input is blank.
For example, when the date is checked, the return value, , is an array with elements 1 through 3 containing the day, month and year components of the input string.
For the time check, the array returned includes the hour (pos 1), minutes (pos 2) and, optionally, the am/pm string (pos 3).