Or you could use a regular expression:
$probe = '2000-01-01';
$found = preg_match('/(19|20)\d\d[- \.](0[1-9]|1[012])[-
\.](0[1-9]|[12][0-9]|3[01])/', $probe);
var_dump($found==1);
Erwin
2012/7/3 shiplu
> >
> >
> > I want to thank you, Daniel, for this help. - I was looking for an
> > "isarray
>
>
> I want to thank you, Daniel, for this help. - I was looking for an
> "isarray" type function
There is no such function or facility in php. However you can check date in
string by DateTime object also
try {
$date = new DateTime('2000-01-01');
} catch (Exception $e) {
echo $e->getMe
On Mon, Jul 2, 2012 at 2:54 PM, Ron Piggott
wrote:
Is there a way to test a variable contains a valid date
- 4 digits for the year
- 2 digits for the month (including leading 0)
- 2 digits for the day (including leading 0)
OR
- a function?
You may want to check out checkdate():
h
On Mon, Jul 2, 2012 at 2:54 PM, Ron Piggott
wrote:
>
> Is there a way to test a variable contains a valid date
> - 4 digits for the year
> - 2 digits for the month (including leading 0)
> - 2 digits for the day (including leading 0)
>
> OR
>
> - a function?
You may want to check out checkdate
4 matches
Mail list logo