I'm having users enter dates in MM-DD-YYYY format. is there a way to check if what they have entered is invalid (like if they enter 1-15-2008 instead of 01-15-2008) ?
Something like this: http://www.phpguru.org/date_preg/ <?php // Get this from where ever (format MM-DD-YYYY) echo ($input = '01-02-2008') . '<br /><br />'; $result = preg_match('/(\d{2})-(\d{2})-(\d{4})/', $input, $matches); $date = $matches[2]; // Note month/date switched $month = $matches[1]; // Note month/date switched $year = $matches[3]; if (!$result) { // Doesn't match... } echo "Date: {$date}<br />"; echo "Month: {$month}<br />"; echo "Year: {$year}<br />"; ?> -- Richard Heyes http://www.websupportsolutions.co.uk Mailing list management service allowing you to reach your Customers and increase your sales. ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php