summaryrefslogtreecommitdiffstats
path: root/core/java/android/text
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-03-18 17:21:33 -0700
committerElliott Hughes <enh@google.com>2013-03-18 17:21:33 -0700
commitcdafd37f3148dfc6f44f2e5de8b31adb6bf9e476 (patch)
tree4756d59bc44ff349748abd89473ffcdf88a92c03 /core/java/android/text
parent6317315e733f115aa6ad0339c1a334607fd04342 (diff)
downloadframeworks_base-cdafd37f3148dfc6f44f2e5de8b31adb6bf9e476.zip
frameworks_base-cdafd37f3148dfc6f44f2e5de8b31adb6bf9e476.tar.gz
frameworks_base-cdafd37f3148dfc6f44f2e5de8b31adb6bf9e476.tar.bz2
Clean up (some of) our many clocks to use H instead of k.
Bug: 8359981 Change-Id: I3c0c38c2bf5adc4b5bdc11c3d10cf41dd8fb6462
Diffstat (limited to 'core/java/android/text')
-rw-r--r--core/java/android/text/format/DateFormat.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/text/format/DateFormat.java b/core/java/android/text/format/DateFormat.java
index c4e960a..50b1a29 100644
--- a/core/java/android/text/format/DateFormat.java
+++ b/core/java/android/text/format/DateFormat.java
@@ -170,9 +170,18 @@ public class DateFormat {
* @return the {@link java.text.DateFormat} object that properly formats the time.
*/
public static java.text.DateFormat getTimeFormat(Context context) {
+ return new java.text.SimpleDateFormat(getTimeFormatString(context));
+ }
+
+ /**
+ * Returns a String pattern that can be used to format the time according
+ * to the current locale and the user's 12-/24-hour clock preference.
+ * @param context the application context
+ * @hide
+ */
+ public static String getTimeFormatString(Context context) {
LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
- boolean is24 = is24HourFormat(context);
- return new java.text.SimpleDateFormat(is24 ? d.timeFormat24 : d.timeFormat12);
+ return is24HourFormat(context) ? d.timeFormat24 : d.timeFormat12;
}
/**