How can I make sure the user enters a date in format
mm/dd/yyyy and the date must be between the year 1600
and 2038.

The script below meets the criterion above, except
mktime() or strtotime() does not validate year 1600
dates.  Any suggestions?  Thanks
 
$dateparts = explode('/', $Date);
$month = $dateparts[0];
$day = $dateparts[1];
$year = $dateparts[2];
$date1 = date ("m/d/Y", mktime
(0,0,0,$month,$day,$year));
if (!$Date) {
  $submit = 0;
  $Date = "<B>Date Required</B>";
}
elseif (!checkdate($month,$day,$year)) {
  $submit = 0;
  $Date = "<B>Invalid Date</B>";
}
elseif ($Date != $date1) {
  $submit = 0;
  $Date = "<B>Invalid Date</B>";
}
elseif ($year < 1600 || $year > 2030) {
  $submit = 0;
  $Date = "<B>Invalid Date</B>";
}  

          

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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

Reply via email to