Validating dates in php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Validating dates in php

I'm trying to validate date on php and also validate end date to be greater than start date.

12th Apr 2017, 12:35 PM
Suhaila Mohammed
Suhaila Mohammed - avatar
5 Answers
+ 2
What's your date format?
12th Apr 2017, 12:38 PM
Geoffrey L
Geoffrey L - avatar
+ 2
dd-mm-yyyy
12th Apr 2017, 12:45 PM
Suhaila Mohammed
Suhaila Mohammed - avatar
+ 2
Here is a regex to match your date format: /\d{2}\-\d{2}\-\d{4}/ 2 digits - 2 digits - 4 digits
12th Apr 2017, 12:50 PM
Geoffrey L
Geoffrey L - avatar
+ 1
@Ace thank you it was the function that had me confused
12th Apr 2017, 9:22 PM
Suhaila Mohammed
Suhaila Mohammed - avatar
+ 1
thanks everyone
12th Apr 2017, 9:22 PM
Suhaila Mohammed
Suhaila Mohammed - avatar