java/com/android/dialer/calllogutils/CallEntryFormatter.java
/**
   * Formats the provided date into a value suitable for display in the current locale.
   *
   * <p>For example, returns a string like "Wednesday, May 25, 2016, 8:02PM" or "Chorshanba, 2016
   * may 25,20:02".
   *
   * <p>For pre-N devices, the returned value may not start with a capital if the local convention
   * is to not capitalize day names. On N+ devices, the returned value is always capitalized.
   */
Formats the provided date into a value suitable for display in the current locale.

For pre-N devices, the returned value may not start with a capital if the local convention
is to not capitalize day names. On N+ devices, the returned value is always capitalized.
Formats the provided date into a value suitable for display in the current locale . For pre - N devices the returned value may not start with a capital if the local convention is to not capitalize day names . On N + devices the returned value is always capitalized .
public static CharSequence formatDate(Context context, long callDateMillis) {
    CharSequence dateValue =
        DateUtils.formatDateRange(
            context,
            callDateMillis /* startDate */,
            callDateMillis /* endDate */,
            DateUtils.FORMAT_SHOW_TIME
                | DateUtils.FORMAT_SHOW_DATE
                | DateUtils.FORMAT_SHOW_WEEKDAY
                | DateUtils.FORMAT_SHOW_YEAR);
     The ICU library was not available in Android until N, so we can only do this in N+ devices.
     Pre-N devices will still see incorrect capitalization in some languages.
    if (VERSION.SDK_INT < VERSION_CODES.N) {
      return dateValue;
    }
     Using the ICU library is safer than just applying toUpperCase() on the first letter of the
     word because in some languages, there can be multiple starting characters which should be
     upper-cased together. For example in Dutch "ij" is a digraph in which both letters should be
     capitalized together.
     TITLECASE_NO_LOWERCASE is necessary so that things that are already capitalized like the
     month ("May") are not lower-cased as part of the conversion.
    return UCharacter.toTitleCase(
        Locale.getDefault(),
        dateValue.toString(),
        BreakIterator.getSentenceInstance(),
        UCharacter.TITLECASE_NO_LOWERCASE);
  }
public static CharSequence formatDate ( Context context , long callDateMillis ) { CharSequence dateValue = DateUtils . formatDateRange ( context , callDateMillis /* startDate */ , callDateMillis /* endDate */ , DateUtils . FORMAT_SHOW_TIME | DateUtils . FORMAT_SHOW_DATE | DateUtils . FORMAT_SHOW_WEEKDAY | DateUtils . FORMAT_SHOW_YEAR ) ; if ( VERSION . SDK_INT < VERSION_CODES . N ) { return dateValue ; } return UCharacter . toTitleCase ( Locale . getDefault ( ) , dateValue . toString ( ) , BreakIterator . getSentenceInstance ( ) , UCharacter . TITLECASE_NO_LOWERCASE ) ; }
Formats the provided date into a value suitable for display in the current locale.
Formats the provided date into a value suitable for display in the current locale .
// We want the beginning of the date string to be capitalized, even if the word at the beginning // of the string is not usually capitalized. For example, "Wednesdsay" in Uzbek is "chorshanba” // (not capitalized). To handle this issue we apply title casing to the start of the sentence so // that "chorshanba, 2016 may 25,20:02" becomes "Chorshanba, 2016 may 25,20:02". // // The ICU library was not available in Android until N, so we can only do this in N+ devices. // Pre-N devices will still see incorrect capitalization in some languages. // Using the ICU library is safer than just applying toUpperCase() on the first letter of the // word because in some languages, there can be multiple starting characters which should be // upper-cased together. For example in Dutch "ij" is a digraph in which both letters should be // capitalized together. // TITLECASE_NO_LOWERCASE is necessary so that things that are already capitalized like the // month ("May") are not lower-cased as part of the conversion.