Best way to validate a date

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm looking to validate a date submitted through a
form and I cannot decide which would be the best way
to do it.  The form of the date needs to be:
YYYY-MM-DD.
At the moment I'm torn between using a regex,
something like: 20[\d][\d]-[0-1][\d]-[0-3][\d]
or using the checkdate() function.

Does anyone have any pros and/or cons to implement one
method over the other or other methods you may have
used?

Thanks,
David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux