mktime() problem

From: Date: Tue, 05 Feb 2002 22:11:29 +0000
Subject: mktime() problem
Groups: php.general 
Request: Send a blank email to php-general+get-83644@lists.php.net to get a copy of this message
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

« previous php.general (#83644) next »