Here you can find the source of getHumanDisplayForTimediff(Long diffMillis)
public static String getHumanDisplayForTimediff(Long diffMillis)
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String getHumanDisplayForTimediff(Long diffMillis) { if (diffMillis == null) { return ""; }/* ww w. j a va2s.com*/ long day = diffMillis / (24 * 60 * 60 * 1000); long hour = (diffMillis / (60 * 60 * 1000) - day * 24); long min = ((diffMillis / (60 * 1000)) - day * 24 * 60 - hour * 60); long se = (diffMillis / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); StringBuilder sb = new StringBuilder(); if (day > 0) { sb.append(day + "D"); } DecimalFormat df = new DecimalFormat("00"); sb.append(df.format(hour) + ":"); sb.append(df.format(min) + ":"); sb.append(df.format(se)); return sb.toString(); } }