List of utility methods to do Long Number to Time
String | getShortTimeText(Long oldTime) get Short Time Text Date time = parseDate(oldTime, TimeFormat); Date now = new Date(); String format = "yyyy-MM-dd HH:mm"; if (time.getYear() == now.getYear()) { format = format.substring("yyyy-".length()); if (time.getMonth() == now.getMonth() && time.getDay() == now.getDay()) { format = format.substring("MM-dd ".length()); return formatDate(time, format); |
String | getSimpleDate(long time) get Simple Date DateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy"); Date date = new Date(time); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormat.format(date); |
String | getSMillon(long time) get S Millon return new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS").format(time); |
String | getSpeedString(long castTime, long bytes) get Speed String double castSecond = (double) castTime / (double) 1000; return parseSpeedString((long) ((double) bytes / castSecond) / 1024); |
String | getStrDateForLong(long time) get Str Date For Long Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(time);
return getDefaultFormatByDate(calendar.getTime());
|
String | getTextDate(long timeInMs) get Text Date return getTextDate((new Date(timeInMs))); |
String | getTime(long nanos) Transforms a number of nano-seconds into a string representing from milliseconds to minutes. NumberFormat doubleFormat = NumberFormat.getNumberInstance(); doubleFormat.setMaximumFractionDigits(2); double millis = (double) nanos / 1000000; if (millis < 1000) { return doubleFormat.format(millis) + "ms"; double secs = millis / 1000; if (secs < 60) { ... |
String | getTime(Long time) get Time Date d = new Date(time); Format simpleFormat = new SimpleDateFormat("E dd MMM yyyy hh:mm:ss a"); String date = simpleFormat.format(d); return date; |
String | getTime(long time, boolean getTimeOnly, boolean fileSystemSafe) get Time return new SimpleDateFormat( getTimeOnly ? "HH-mm-ss" : fileSystemSafe ? "MM-dd-yyyy_HH.mm.ss" : "MM/dd/yyyy'\t'h:mm:ss a") .format(new Date(time)); |
String | getTimeFromLong(long diff) Returns a formatted String from time. final String HOURS = "h"; final String MINUTES = "min"; final long MS_IN_A_DAY = 1000 * 60 * 60 * 24; final long MS_IN_AN_HOUR = 1000 * 60 * 60; final long MS_IN_A_MINUTE = 1000 * 60; final long MS_IN_A_SECOND = 1000; diff = diff % MS_IN_A_DAY; long numHours = diff / MS_IN_AN_HOUR; ... |