RE: [PHP] Date Validation, Kinda'
| From: | Chris W. Parker | Date: | Thu, 21 Aug 2003 20:29:07 +0000 |
| Subject: | RE: [PHP] Date Validation, Kinda' | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160348@lists.php.net to get a copy of this message | ||
Jay Blanchard <mailto:jay.blanchard@niicommunications.com>
on Thursday, August 21, 2003 1:24 PM said:
> It is to make sure that the user has entered a valid future date in
> the YYYYMMDD format into the form.
(You may very well already know of these two functions and already
thought of what I'm going to tell you but I thought I should share
anyway.)
In that case maybe these two functions will get you going:
www.php.net/checkdate
www.php.net/getdate
I'm thinking this:
1. you get the date from the user
2. validate it using checkdate()
3. get the current date
4. compare the two dates to see if the users date is later than todays
date
5. return true or return false
Sound good?
Chris.