Output the amount of time that has elapsed since the given date in the
format x days, xx:xx.

@return A string representing the formatted interval.
501443
public static String getUpTime() {
        long diff = ManagementFactory.getRuntimeMXBean().getUptime();
        diff /= 1000 * 60;
        long minutes = diff % 60;
        diff /= 60;
        long hours = diff % 24;
        diff /= 24;
        long days = diff;
        StringBuilder buf = new StringBuilder();
        if (days == 1) {
            buf.append("1 day ");
        } else if (days > 1) {
            buf.append(Long.valueOf(days).toString()).append(" days ");
        }
        DecimalFormat format = new DecimalFormat();
        format.setMinimumIntegerDigits(2);
        buf.append(format.format(hours)).append(":")
                .append(format.format(minutes));
        return buf.toString();
    }
392408
private static String getDuration(long millis) {
        long tsec = millis / 1000;
        long h = tsec / 60 / 60;
        long m = (tsec - h * 60 * 60) / 60;
        long s = tsec - h * 60 * 60 - m * 60;
        StringBuffer out = new StringBuffer();
        if (h > 0) {
            out.append(h + " hour");
            if (h > 1) {
                out.append('s');
            }
        }
        if (m > 0) {
            if (h > 0) {
                out.append(", ");
            }
            out.append(m + " minute");
            if (m > 1) {
                out.append('s');
            }
        }
        if (s > 0 || h == 0 && m == 0) {
            if (h > 0 || m > 0) {
                out.append(", ");
            }
            out.append(s + " second");
            if (s != 1) {
                out.append('s');
            }
        }
        return out.toString();
    }
373546
public static String formatDuration(long millis) {
		StringBuilder sb = new StringBuilder();
		if(millis > DAY_MILLIS) {
			sb.append(millis / DAY_MILLIS);
			sb.append(" days, ");
			millis %= DAY_MILLIS;
		}
		if(millis > HOUR_MILLIS) {
			sb.append(millis / HOUR_MILLIS);
			sb.append(" hours, ");
			millis %= HOUR_MILLIS;
		}
		if(millis > MINUTE_MILLIS) {
			sb.append(millis / MINUTE_MILLIS);
			sb.append(" minutes, ");
			millis %= MINUTE_MILLIS;
		}
		if(millis > SECOND_MILLIS) {
			sb.append(millis / SECOND_MILLIS);
			sb.append(" seconds, ");
			millis %= SECOND_MILLIS;
		}
		sb.append(millis);
		sb.append(" milliseconds");
		return sb.toString();
	}
648913
@Benchmark
	@BenchmarkMode(Mode.Throughput)
	public String formatDate() {
		synchronized (SIMPLE_DATE_FORMAT) {
			return SIMPLE_DATE_FORMAT.format(DATE);
		}
	}
212378
public Date getLastIndexed() {
		Date lastIndexed = null;
		TableIndex tableIndex = getTableIndex();
		if (tableIndex != null) {
			lastIndexed = tableIndex.getLastIndexed();
		}
		return lastIndexed;
	}
1235793
public final String getFinishFormattedLong() {
        Granularity finishGran = this.interval.getFinishGranularity();
        return formatFinish(finishGran != null ? finishGran.getLongFormat()
                : null);
    }
163540
public static long todayEndSeconds(){
		Date curTime = new Date();
		return DateUtils.getDiffSeconds(DateUtils.getDayEnd(curTime), curTime);
	}
1345255
private String format(final Date date) {
		synchronized (formatter) {
			if (lastDate == null || date.getTime() / divisor != lastDate.getTime() / divisor) {
				lastDate = date;
				lastFormat = formatter.format(date);
			}
			return lastFormat;
		}
	}
1079515
public String doFormatDate(long date) {
        buf.setLength(0);
        gc.setTimeInMillis(date);

        int day_of_week = gc.get(Calendar.DAY_OF_WEEK);
        int day_of_month = gc.get(Calendar.DAY_OF_MONTH);
        int month = gc.get(Calendar.MONTH);
        int year = gc.get(Calendar.YEAR);
        int century = year / 100;
        year = year % 100;

        int hours = gc.get(Calendar.HOUR_OF_DAY);
        int minutes = gc.get(Calendar.MINUTE);
        int seconds = gc.get(Calendar.SECOND);

        buf.append(DAYS[day_of_week]);
        buf.append(',');
        buf.append(' ');
        StringUtils.append2digits(buf, day_of_month);

        buf.append(' ');
        buf.append(MONTHS[month]);
        buf.append(' ');
        StringUtils.append2digits(buf, century);
        StringUtils.append2digits(buf, year);

        buf.append(' ');
        StringUtils.append2digits(buf, hours);
        buf.append(':');
        StringUtils.append2digits(buf, minutes);
        buf.append(':');
        StringUtils.append2digits(buf, seconds);
        buf.append(" GMT");
        return buf.toString();
    }
102185
public static String format(Date date) {
    Calendar calendar = new GregorianCalendar(TIMEZONE_Z, Locale.US);
    calendar.setTime(date);

    // estimate capacity of buffer as close as we can (yeah, that's pedantic ;)
    int capacity = "yyyy-MM-ddThh:mm:ss.sssZ".length();
    StringBuilder formatted = new StringBuilder(capacity);
    padInt(formatted, calendar.get(Calendar.YEAR), "yyyy".length());
    formatted.append('-');
    padInt(formatted, calendar.get(Calendar.MONTH) + 1, "MM".length());
    formatted.append('-');
    padInt(formatted, calendar.get(Calendar.DAY_OF_MONTH), "dd".length());
    formatted.append('T');
    padInt(formatted, calendar.get(Calendar.HOUR_OF_DAY), "hh".length());
    formatted.append(':');
    padInt(formatted, calendar.get(Calendar.MINUTE), "mm".length());
    formatted.append(':');
    padInt(formatted, calendar.get(Calendar.SECOND), "ss".length());
    formatted.append('.');
    padInt(formatted, calendar.get(Calendar.MILLISECOND), "sss".length());
    formatted.append('Z');
    return formatted.toString();
  }
195709
public static String
format(Date date) {
	Calendar c = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
	StringBuffer sb = new StringBuffer();

	c.setTime(date);
	sb.append(w4.format(c.get(Calendar.YEAR)));
	sb.append(w2.format(c.get(Calendar.MONTH)+1));
	sb.append(w2.format(c.get(Calendar.DAY_OF_MONTH)));
	sb.append(w2.format(c.get(Calendar.HOUR_OF_DAY)));
	sb.append(w2.format(c.get(Calendar.MINUTE)));
	sb.append(w2.format(c.get(Calendar.SECOND)));
	return sb.toString();
}
237345
public String timestamp() {
        float totalSeconds = this.length();
        float second = totalSeconds % 60;
        int minute = (int) totalSeconds / 60 % 60;
        int hour = (int) (totalSeconds / 3600);

        StringBuilder sb = new StringBuilder();
        if (hour > 0) {
            sb.append(hour + ":");
        }
        if (minute > 0) {
            sb.append(minute + ":");
        }
        sb.append(second);

        return sb.toString();
    }
256656
public static int getMinutes(final Date date)
	{
		final Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		return calendar.get(Calendar.MINUTE);
	}
380621
public String getFormatedTimestamp()
    {
        if(date == null){return "";}
        
        StringBuilder sb = new StringBuilder();
        GregorianCalendar g = new GregorianCalendar();
        g.setTime(date);
        sb.append(String.valueOf(g.get(GregorianCalendar.YEAR))).append("-");
        sb.append(twoDigitFormat(g.get(GregorianCalendar.MONTH) + 1)).append("-");
        sb.append(twoDigitFormat(g.get(GregorianCalendar.DAY_OF_MONTH))).append(" ");
        sb.append(twoDigitFormat(g.get(GregorianCalendar.HOUR))).append(":");
        sb.append(twoDigitFormat(g.get(GregorianCalendar.MINUTE))).append(":");
        sb.append(twoDigitFormat(g.get(GregorianCalendar.SECOND)));
        
        return sb.toString();
    }
454041
private String formatTime(final long elapsedTicks) {
		String formattedTime = "";
		// should be hh:mm:ss.SSS, but 00 starts with 01
		SimpleDateFormat formatter = new SimpleDateFormat("00:mm:ss.SSS");
		Calendar calendar = Calendar.getInstance();

		if (elapsedTicks <= 9999) {
			calendar.setTimeInMillis(0);
			formattedTime = formatter.format(calendar.getTime()) + String.valueOf(String.format("%04d", elapsedTicks));
		} else {
			calendar.setTimeInMillis(elapsedTicks * nsPerTick / nsPerMs);
			String formattedTicks = String.format("%07d", elapsedTicks);
			formattedTicks = formattedTicks.substring(formattedTicks.length() - 4);
			formattedTime = formatter.format(calendar.getTime()) + formattedTicks;
		}
		return formattedTime;
	}
1236385
static String formatTime() {
        Date date = new Date();
        DateFormat formatter = BaseTraceFormatter.useIsoDateFormat ? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") : DateFormatProvider.getDateFormat();
        StringBuffer answer = new StringBuffer();
        answer.append('[');
        formatter.format(date, answer, new FieldPosition(0));
        answer.append(']');
        return answer.toString();
    }
990551
public final TemporalAmount getDuration() {
        if (duration == null) {
            return TemporalAmountAdapter.fromDateRange(getStart(), getEnd()).getDuration();
        }
        return duration.getDuration();
    }