diff --git a/src/com/android/contacts/editor/EventFieldEditorView.java b/src/com/android/contacts/editor/EventFieldEditorView.java
index 94846a0..0925add 100644
--- a/src/com/android/contacts/editor/EventFieldEditorView.java
+++ b/src/com/android/contacts/editor/EventFieldEditorView.java
@@ -121,7 +121,8 @@
     private void rebuildDateView() {
         final EditField editField = getKind().fieldList.get(0);
         final String column = editField.column;
-        String data = DateUtils.formatDate(getContext(), getEntry().getAsString(column));
+        String data = DateUtils.formatDate(getContext(), getEntry().getAsString(column),
+                false /*Use the short DateFormat to ensure that it fits inside the EditText*/);
         if (TextUtils.isEmpty(data)) {
             mDateView.setText(mNoDateString);
             mDateView.setTextColor(mSecondaryTextColor);
diff --git a/src/com/android/contacts/util/DateUtils.java b/src/com/android/contacts/util/DateUtils.java
index 72a53a0..dc9027c 100644
--- a/src/com/android/contacts/util/DateUtils.java
+++ b/src/com/android/contacts/util/DateUtils.java
@@ -52,20 +52,12 @@
         new SimpleDateFormat("yyyyMMdd'T'HHmm'Z'", Locale.US),
     };
 
-    private static final java.text.DateFormat FORMAT_WITHOUT_YEAR_MONTH_FIRST =
-            new SimpleDateFormat("MMMM dd");
-
-    private static final java.text.DateFormat FORMAT_WITHOUT_YEAR_DAY_FIRST =
-            new SimpleDateFormat("dd MMMM");
-
     static {
         for (SimpleDateFormat format : DATE_FORMATS) {
             format.setLenient(true);
             format.setTimeZone(UTC_TIMEZONE);
         }
         CommonDateUtils.NO_YEAR_DATE_FORMAT.setTimeZone(UTC_TIMEZONE);
-        FORMAT_WITHOUT_YEAR_MONTH_FIRST.setTimeZone(UTC_TIMEZONE);
-        FORMAT_WITHOUT_YEAR_DAY_FIRST.setTimeZone(UTC_TIMEZONE);
     }
 
     /**
@@ -96,11 +88,30 @@
     }
 
     /**
-     * Parses the supplied string to see if it looks like a date. If so,
-     * returns the same date in a cleaned-up format for the user.  Otherwise, returns
-     * the supplied string unchanged.
+     * Same as {@link #formatDate(Context context, String string, boolean longForm)}, with
+     * longForm set to {@code true} by default.
+     *
+     * @param context Valid context
+     * @param string String representation of a date to parse
+     * @return Returns the same date in a cleaned up format. If the supplied string does not look
+     * like a date, return it unchanged.
      */
+
     public static String formatDate(Context context, String string) {
+        return formatDate(context, string, true);
+    }
+
+    /**
+     * Parses the supplied string to see if it looks like a date.
+     *
+     * @param context Valid context
+     * @param string String representation of a date to parse
+     * @param longForm If true, return the date formatted into its long string representation.
+     * If false, return the date formatted using its short form representation (i.e. 12/11/2012)
+     * @return Returns the same date in a cleaned up format. If the supplied string does not look
+     * like a date, return it unchanged.
+     */
+    public static String formatDate(Context context, String string, boolean longForm) {
         if (string == null) {
             return null;
         }
@@ -127,10 +138,9 @@
         }
 
         if (noYearParsed) {
-            java.text.DateFormat outFormat = isMonthBeforeDay(context)
-                    ? FORMAT_WITHOUT_YEAR_MONTH_FIRST
-                    : FORMAT_WITHOUT_YEAR_DAY_FIRST;
+            final java.text.DateFormat outFormat = getLocalizedDateFormatWithoutYear(context);
             synchronized (outFormat) {
+                outFormat.setTimeZone(UTC_TIMEZONE);
                 return outFormat.format(date);
             }
         }
@@ -141,9 +151,11 @@
                 parsePosition.setIndex(0);
                 date = f.parse(string, parsePosition);
                 if (parsePosition.getIndex() == string.length()) {
-                    java.text.DateFormat outFormat = DateFormat.getDateFormat(context);
-                    outFormat.setTimeZone(UTC_TIMEZONE);
-                    return outFormat.format(date);
+                    final java.text.DateFormat outFormat =
+                            longForm ? DateFormat.getLongDateFormat(context) :
+                            DateFormat.getDateFormat(context);
+                        outFormat.setTimeZone(UTC_TIMEZONE);
+                        return outFormat.format(date);
                 }
             }
         }
@@ -170,7 +182,7 @@
      * determine whether the month field should be displayed before the day field, and returns
      * either "MMMM dd" or "dd MMMM" converted into a SimpleDateFormat.
      */
-    public static SimpleDateFormat getLocalizedDateFormatWithoutYear(Context context) {
+    public static java.text.DateFormat getLocalizedDateFormatWithoutYear(Context context) {
         final String pattern = ((SimpleDateFormat) SimpleDateFormat.getDateInstance(
                 java.text.DateFormat.LONG)).toPattern();
         // Determine the correct regex pattern for year.
@@ -181,9 +193,6 @@
          // Eliminate the substring in pattern that matches the format for that of year
             return new SimpleDateFormat(pattern.replaceAll(yearPattern, ""));
         } catch (IllegalArgumentException e) {
-            // In case the new pattern isn't handled by SimpleDateFormat, fall back to the original
-            // method of constructing the SimpleDateFormat, which may not be appropriate for all
-            // locales (i.e. Germany)
             return new SimpleDateFormat(
                     DateUtils.isMonthBeforeDay(context) ? "MMMM dd" : "dd MMMM");
         }
