summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/format
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-03-19 09:31:04 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-03-19 09:31:04 -0700
commitf7c01e5a8a4e7e3032dd03a3705f6894312e9b5f (patch)
tree89cb469209bc162ea2aa01751cb8559752fcc7e5 /core/java/android/text/format
parentd7cbec6d10d520225806feda21f8656d9380797a (diff)
parenteda35cb7c5781a32b038f1ef76b8e50f26f9bfaf (diff)
downloadframeworks_base-f7c01e5a8a4e7e3032dd03a3705f6894312e9b5f.zip
frameworks_base-f7c01e5a8a4e7e3032dd03a3705f6894312e9b5f.tar.gz
frameworks_base-f7c01e5a8a4e7e3032dd03a3705f6894312e9b5f.tar.bz2
am eda35cb7: am a8974d3f: Merge "Clean up (some of) our many clocks to use H instead of k."
* commit 'eda35cb7c5781a32b038f1ef76b8e50f26f9bfaf': Clean up (some of) our many clocks to use H instead of k.
Diffstat (limited to 'core/java/android/text/format')
-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 9e7c93c..f813df3 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;
}
/**