diff options
| -rw-r--r-- | main/src/cgeo/geocaching/export/FieldnoteExport.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/ui/Formatter.java | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java index d59434a..05c62e3 100644 --- a/main/src/cgeo/geocaching/export/FieldnoteExport.java +++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java @@ -83,7 +83,7 @@ class FieldnoteExport extends AbstractExport { final CheckBox onlyNewOption = (CheckBox) layout.findViewById(R.id.onlynew); if (Settings.getFieldnoteExportDate() > 0) { - onlyNewOption.setText(getString(R.string.export_fieldnotes_onlynew) + "\n(" + Formatter.formatShortDateTime(Settings.getFieldnoteExportDate()) + ')'); + onlyNewOption.setText(getString(R.string.export_fieldnotes_onlynew) + "\n(" + Formatter.formatDateTime(Settings.getFieldnoteExportDate()) + ')'); } builder.setPositiveButton(R.string.export, new DialogInterface.OnClickListener() { diff --git a/main/src/cgeo/geocaching/ui/Formatter.java b/main/src/cgeo/geocaching/ui/Formatter.java index 963807f..49c7a50 100644 --- a/main/src/cgeo/geocaching/ui/Formatter.java +++ b/main/src/cgeo/geocaching/ui/Formatter.java @@ -1,9 +1,9 @@ package cgeo.geocaching.ui; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.enumerations.CacheListType; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.WaypointType; @@ -107,6 +107,18 @@ public abstract class Formatter { return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL); } + /** + * Generate a numeric date and time string according to system-wide settings (locale, + * date format) such as "7 september at 12:35". + * + * @param date + * milliseconds since the epoch + * @return the formatted string + */ + public static String formatDateTime(long date) { + return DateUtils.formatDateTime(context, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME); + } + public static String formatCacheInfoLong(Geocache cache, CacheListType cacheListType) { final ArrayList<String> infos = new ArrayList<String>(); if (StringUtils.isNotBlank(cache.getGeocode())) { |
