Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 10177)
+++ wp-includes/general-template.php	(working copy)
@@ -1158,23 +1158,23 @@
  * @param bool $echo Optional, default is display. Whether to echo the date or return it.
  * @return string|null Null if displaying, string if retrieving.
  */
-function the_date($d='', $before='', $after='', $echo = true) {
-	global $post, $day, $previousday;
+function the_date( $d='', $before='', $after='', $echo = true ) {
+	global $post, $previousday;
 	$the_date = '';
-	if ( $day != $previousday ) {
-		$the_date .= $before;
-		if ( $d=='' )
-			$the_date .= mysql2date(get_option('date_format'), $post->post_date);
+	$the_date .= $before;
+	if ( '' == $d )
+		$the_date .= mysql2date( get_option( 'date_format' ), $post->post_date );
+	else
+		$the_date .= mysql2date( $d, $post->post_date );
+	$the_date .= $after;
+	$the_date = apply_filters( 'the_date', $the_date, $d, $before, $after);
+	if ( $the_date != $previousday ) {
+		$previousday = $the_date;
+		if ( $echo )
+			echo $the_date;
 		else
-			$the_date .= mysql2date($d, $post->post_date);
-		$the_date .= $after;
-		$previousday = $day;
+			return $the_date;
 	}
-	$the_date = apply_filters('the_date', $the_date, $d, $before, $after);
-	if ( $echo )
-		echo $the_date;
-	else
-		return $the_date;
 }
 
 /**
