0

Users are able to choose a date and time in a custom pop-up box.

It currently looks like this when users input the time and date:

DD.MM.YYY HH.MM

How can I validate this format in Codeigniter upon submitting, using the form validation library?

kanarifugl
  • 9,887
  • 5
  • 29
  • 39
  • You just want a regex to match this? a regex to match your given pattern is this: `[0-3][0-9].[0-1][0-9].\d{4}\s[0-1][0-9].[0-6][0-9]` – demogorgon Aug 12 '17 at 16:36
  • Possible duplicate of [Codeigniter - Date format - Form Validation](https://stackoverflow.com/questions/14359158/codeigniter-date-format-form-validation) – Deep 3015 Aug 12 '17 at 16:38

1 Answers1

0

Use this regex

(0[1-9]|[1-2][0-9]|3[0-1]).(0[1-9]|1[1-2]).\d{4}\s([0-1][0-9]|2[0-3]).[0-5][0-9]

Here is the working example of it

Sahib Yar
  • 1,030
  • 11
  • 29