Index: post.php
===================================================================
--- post.php	(revision 26796)
+++ post.php	(working copy)
@@ -2802,10 +2802,12 @@
 		$post_date = current_time('mysql');
 
 		// validate the date
-		$mm = substr( $post_date, 5, 2 );
-		$jj = substr( $post_date, 8, 2 );
-		$aa = substr( $post_date, 0, 4 );
-		$valid_date = wp_checkdate( $mm, $jj, $aa, $post_date );
+                preg_match("/^(?P<year>\d{4})-(?P<month>0?[1-9]|1[012])-(?P<day>0?[1-9]|[12][0-9]|3[01])/", $post_date, $matches);
+                
+                $valid_date = false;
+                if ( count( $matches ) >= 6 ) // Each capture group in the REGEX creates two array elements 
+                    $valid_date = wp_checkdate( (int) $matches['month'], (int) $matches['day'], (int) $matches['year'], $post_date );
+                
 		if ( !$valid_date ) {
 			if ( $wp_error )
 				return new WP_Error( 'invalid_date', __( 'Whoops, the provided date is invalid.' ) );
