diff options
author | cyBerta <cyberta@riseup.net> | 2022-11-11 18:50:23 +0100 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2022-11-22 01:48:38 +0100 |
commit | 7d5e33aeab1ba02148be041c29ad6b4220d83b27 (patch) | |
tree | 0daf62b8de6de8a04ba9b5065b0f7617a70125ee /app/src/main/java/se/leap/bitmaskclient/base/utils | |
parent | c6435f2e9831b6c99836701b42a45a10ea81bb61 (diff) |
stub implementation to start motd UI on app start if required
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base/utils')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java index 0476bf12..2e9c2b24 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/DateHelper.java @@ -12,6 +12,7 @@ import java.util.Locale; */ public class DateHelper { private static final String DATE_PATTERN = "dd/MM/yyyy"; + private static final String DATE_PATTERN_RFC822_NUMERIC_ZONE = "dd MMM yy hh:mm Z"; // RFC822 with numeric zone private static final int ONE_DAY = 86400000; //1000*60*60*24 public static long getDateDiffToCurrentDateInDays(String startDate) throws ParseException { @@ -26,4 +27,14 @@ public class DateHelper { Date lastDate = new Date(); return sdf.format(lastDate); } + + /** + * Return date in a specific format bitmaskcore can handle. + * @param milliSeconds Date in milliseconds + * @return String representing date in specified format + */ + public static String getFormattedDateWithTimezone(long milliSeconds) throws IllegalArgumentException { + SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN_RFC822_NUMERIC_ZONE, Locale.US); + return sdf.format(milliSeconds); + } } |