Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.290
diff -u -p -r1.290 profile.module
--- modules/profile/profile.module	23 Apr 2010 04:32:16 -0000	1.290
+++ modules/profile/profile.module	28 Apr 2010 02:30:33 -0000
@@ -296,20 +296,29 @@ function profile_view_field($account, $f
       case 'url':
         return '<a href="' . check_url($value) . '">' . check_plain($value) . '</a>';
       case 'date':
-        $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
         // Note: Avoid PHP's date() because it does not handle dates before
         // 1970 on Windows. This would make the date field useless for e.g.
         // birthdays.
-        $replace = array(
-          'd' => sprintf('%02d', $value['day']),
-          'j' => $value['day'],
-          'm' => sprintf('%02d', $value['month']),
-          'M' => map_month($value['month']),
-          'Y' => $value['year'],
-          'H:i' => NULL,
-          'g:ia' => NULL,
-        );
-        return strtr($format, $replace);
+        $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
+
+        if ($value['year'] > 2038 || $value['year'] < 1970) {
+          /**
+           * By using the calculated year, all date() format characters except
+           * for 'c', 'r', 'U', and 'o' should work just fine.  All other
+           * calculations should be normal, including weeks, day counts, etc.
+           */
+          $calculated_year = $value['year'] < 1970 ? 
+            $value['year'] + ceil((1970 - $value['year']) / 28) * 28 : 
+            $value['year'] - ceil(($value['year'] - 2028) / 28) * 28;
+
+          $format = str_replace(array('Y', 'y'), array("\xFF", "\xFE"), $format);
+          $calculated_date = date($format, mktime(0, 0, 0, $value['month'], $value['day'], $calculated_year));
+
+          return str_replace(array("\xFF", "\xFE"), array($value['year'], substr($value['year'], 2, 2)), $calculated_date);
+        }
+        else {
+          return date($format, mktime(0, 0, 0, $value['month'], $value['day'], $value['year']));
+        }
       case 'list':
         $values = preg_split("/[,\n\r]/", $value);
         $fields = array();
