List of utility methods to do Long to Date Convert
String | getRelativeDateLabel(long time) get Relative Date Label long curTime = System.currentTimeMillis(); long startTimeOfToday = getStartTimeOfDay(curTime); if (time > curTime) { return getDateLabel(time); } else if (time > startTimeOfToday) { return getTimeLabel(time); } else { return getDateLabel(time); ... |
String | getRelativeTimeFromMilliSeconds(long dateInMillis) get Relative Time From Milli Seconds final String relativeTime = DateUtils.getRelativeTimeSpanString( dateInMillis, System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS).toString(); return formatRelativeTime(relativeTime); |
String | getShortDateString(long date, Locale locale) get Short Date String return getDateString(date, DateFormat.SHORT, locale);
|
String | getShortDateTimeString(long date, Locale locale) get Short Date Time String return getDateTimeString(new Date(date), DateFormat.SHORT, locale); |
String | getSimpleDatetime(long milliseconds) get Simple Datetime Date date = new Date(milliseconds); DateFormat sdf = SimpleDateFormat.getDateTimeInstance(); return sdf.format(date); |
String | getStandardTime(long timestamp) get Standard Time, "MM/dd/HH:mm" SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/HH:mm"); Date date = new Date(timestamp * 1000); sdf.format(date); return sdf.format(date); |
long | getStartTimeOfDay(long timeInLong) get Start Time Of Day Time time = new Time(); time.set(timeInLong); Time dayStartTime = new Time(); dayStartTime.year = time.year; dayStartTime.month = time.month; dayStartTime.monthDay = time.monthDay; return dayStartTime.toMillis(true); |
String | getStringOfLong(long date) get String Of Long SimpleDateFormat sdf; sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); today = sdf.format(date); return today; |
String | getTimeInterval(long interval) get Time Interval if (interval <= 0) { return "00:00:00"; long intervalSeconds = interval / 1000; long hours = intervalSeconds / 3600; long minutes = (intervalSeconds % 3600) / 60; long seconds = intervalSeconds % 60; String hoursText = String.valueOf(hours); ... |
String | getTimeLabel(long date) get Time Label SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); return sdf.format(date); |