List of utility methods to do Long Number to Time
String | elapsedTimeToString(long elapsedTime) elapsed Time To String Date date = new Date(elapsedTime); DateFormat formatter = new SimpleDateFormat("HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return formatter.format(date); |
String | formattaData(long date) formatta Data try { return _data.format(new Date(date)); } catch (Exception e) { return ""; |
String | formatTime(long date) format Time SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSSS"); System.out.println(formatter.format(date)); return formatter.format(date); |
String | formatTime(long ms) format Time Date d = new Date(ms); Calendar c = new GregorianCalendar(); c.setTime(d); String hours = String.valueOf(c.get(Calendar.HOUR)); String minutes = String.format("%02d", c.get(Calendar.MINUTE)); String seconds = String.format("%02d", c.get(Calendar.SECOND)); String millis = String.valueOf(c.get(Calendar.MILLISECOND)); String retval = hours + ":" + minutes + ":" + seconds + "." + millis ... |
String | formatTimestampLong(long timestamp, String datepattern, TimeZone tz) format a timestamp into a given date pattern string long newTimestamp = timestamp; DateFormat formatter = getDateFormat(datepattern, Locale.US, tz); newTimestamp = newTimestamp / 1000; newTimestamp = newTimestamp * 1000; Date date = new Date(newTimestamp); return formatter.format(date); |
String | formatToUTC(long datetime) format To UTC return formatLongTime(datetime, "yyyyMMdd'T'HHmmss'Z'"); |
String | formatXSDateTime(long lastModified) format XS Date Time Date date = new Date(lastModified); return formatXSDateTime(date); |
String | getAmPm(long time) get Am Pm SimpleDateFormat sf = new SimpleDateFormat("aa"); return sf.format(new Date(time)); |
long | getCollectTimeInLong(Date date) Get the time in long format : "yyyyMMddHHmmss". SimpleDateFormat collectTimeFormat = new SimpleDateFormat("yyyyMMddHHmmss"); return Long.valueOf(collectTimeFormat.format(date)); |
long | getDelay(long delay, long interval) get Delay long current = System.currentTimeMillis(); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); try { current = System.currentTimeMillis() - sf.parse(sf.format(new Date())).getTime(); } catch (ParseException e) { if (current >= delay) { return current - delay; ... |