Hi,
I'm needing to validate user input that they entered the date in the correct format:
(YYYY-MM-DD) or (YYYY/MM/DD)
and to accept something like this:
YYYY-M-D
or any pattern like that:
YYYY-MM-D
YYYY-M-DD
and to make sure the months and days are within an appropriate calendar range.
I'm thinking ereg function is the way to go, but I'm not understanding the tricks of it to allow for this flexibility. So far I had a pattern like:
$value = "200[0-9]-[0-1][0-9]-[0-3][0-9]"
But that only handles a YYYY-MM-DD format. I'm not familiar with how to make this a bit more flexible.
Any help would be appreciated.