You can find the details in Web Services using XMLHttp Request (Ajax) and related articles. It doesn't allow a space after minutes and before the am/pm example: " am" will get an invalid time. I modified the reg to the following: re = /^(\d): (\d)(:00)?
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).
This routine DOES NOT check that the date or time input values are valid, just that they match the required format (d/m/y and h:m). Once you're in control of the input format, it's a lot easier to check that the values are actually valid.
The function has been improved now so that the day, month and year values are checked to ensure that they're in the right ball-bark (ie. Also the year must be between 1902 and the current year.