List of utility methods to do Long Number to Time
String | getDT(long mills) get DT SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.JAPAN); return sdf.format(mills); |
String | getDuration(long time) get Duration NumberFormat f = NumberFormat.getInstance(); f.setMinimumIntegerDigits(2); int milliseconds = (int) (time % 1000); time /= 1000; int seconds = (int) time % 60; time /= 60; int minutes = (int) time % 60; time /= 60; ... |
String | getElapsedTime(long start, long end) get Elapsed Time Calendar result = Calendar.getInstance(); long sa = end - start - result.getTimeZone().getRawOffset(); result.setTimeInMillis(sa); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); return sdf.format(result.getTime()); |
String | getElapsedTime(long startTime, long finishTime) get Elapsed Time if (startTime == 0) { return "-"; return finishTime == 0 ? decimalF.format((System.currentTimeMillis() - startTime) / 1000) + " sec" : decimalF.format((finishTime - startTime) / 1000) + " sec"; |
String | getElapsedTimeSpecificationDescription(long sizeInBytes) Returns a short string description of the size, in bytes, specified. return getElapsedTimeSpecificationDescription(sizeInBytes, "#.##"); |
String | getExpires(long maxAge) get Expires long created = System.currentTimeMillis(); Date expiredate = new Date(created + (maxAge * 1000)); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); return sdf.format(expiredate); |
String | getHMSFromMills(long millSec) get HMS From Mills String retval; int decimal = (int) (millSec % 1000); int seconds = (int) (millSec / 1000); if (seconds > 0) { if (seconds < 60) { retval = seconds + "." + decimal + " sec"; } else { String outStr = getHMS(seconds); ... |
String | getOldCookieDate(long time) Returns a formated date and time String form a timestamp value based on the (old) Netscape cookie date format.
if (OLD_COOKIE.getTimeZone() != GMT_TIMEZONE) { OLD_COOKIE.setTimeZone(GMT_TIMEZONE); return OLD_COOKIE.format(new Date(time)); |
String | getReadableDate(long longTime) get Readable Date DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(longTime); return dateFormat.format(date); |
String | getServerTime(long offset) Get a String containing the current timestamp of the server, for use in the HTTP Date header and caching headers. Calendar calendar = Calendar.getInstance(); Date outDate = new Date(calendar.getTime().getTime() + (offset * 1000)); return dateFormat.format(outDate); |