Posted by Manuel Lemos on 06/27/05 07:13
Hello,
on 06/27/2005 01:04 AM ndsoumah@gmail.com said the following:
> I'm having a hard time trying to validate some dates.
> I have a form that accept dates from users in this format (YYYY-mm-dd).
> I've been looking at the available datetime functions and I'm still
> clueless as to how they can help me achieve my goals.
>
> what I need to do id check is:
> 1- convert the input string into date first. At this point I couldn't
> find any srtTOdate type of functions. then I tried doing it the hard
> way...by using "checkdate" function. I could split the string fine
> (using "explode") but then I was stuck because I couldn't find any
> function to convert a string into Integer!
>
> 2- I need to check if the date is valid
You may want to take a look at this popular forms generation and
validation class that comes with custom input plug-in that lets the user
enter a date that is validated either on the client side with Javascript
and the server side with the class PHP code.
Not only it can validate the date, but also impose optional requirements
to accept dates after a given start date or before a end date.
http://www.phpclasses.org/formsgeneration
Here is a screenshot of an example date form:
http://www.phpclasses.org/browse/file/8245.html
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Navigation:
[Reply to this message]
|