List of utility methods to do Time Format
String | dateToString(Time t) date To String return String.format("%04d%02d%02d", t.year, t.month + 1, t.monthDay); |
String | toISO8601Date(Time date) Liefert ein Time -Objekt als ISO-8601-String (Form: YYYY-MM-DD). String month = normalizeDate("" + date.month); String day = normalizeDate("" + (date.monthDay + 1)); return date.year + "-" + month + "-" + day; |
String | formatDisplay(int second) Format second to display format like 3:20:30 return format(TIME_DISPLAY_FORMAT, second * 1000);
|
String | formatDateAndTime(int timestamp, String pattern) Formats a Unix timestamp in something human readable. long time = timestamp * ONE_SECOND; Date date = new Date(time); SimpleDateFormat formattedDate = new SimpleDateFormat(pattern, Locale.getDefault()); return formattedDate.format(date); |
String | formatDate(String mounthStr) format Date return mounthStr.substring(2, 4) + "/" + mounthStr.substring(4, 6) + "/" + mounthStr.substring(6, 8) + " " + mounthStr.substring(8, 10) + ":" + mounthStr.substring(10, 12); |
String | dateTimeFormat(String dateTime) date Time Format StringBuilder sb = new StringBuilder(); try { if (isEmpty(dateTime)) { return null; String[] dateAndTime = dateTime.split(" "); if (dateAndTime.length > 0) { for (String str : dateAndTime) { ... |
String | dateTimeFormat(String dateTime) date Time Format StringBuilder sb = new StringBuilder(); try { if (isEmpty(dateTime)) { return null; String[] dateAndTime = dateTime.split(" "); if (dateAndTime.length > 0) { for (String str : dateAndTime) { ... |
String | formatDateTime(String date, String format) format Date Time return convertDateTime(convertDateTime(date, DEFAULT_FORMAT_DATE),
format);
|
String | formatTime(long time) format Time Time t = new Time(); t.set(time); return t.format("%d.%m.%Y %H:%M:%S"); |
long | convertDateTime(String date, String format) convert Date Time try { if (format == null) { format = DEFAULT_FORMAT_DATE; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); return simpleDateFormat.parse(date).getTime(); } catch (ParseException e) { e.printStackTrace(); ... |