List of utility methods to do Second Format
String | getFormattedDuration(int simTimeSeconds) get Formatted Duration int hours = simTimeSeconds / TIME_3600; simTimeSeconds = simTimeSeconds - (hours * TIME_3600); int minutes = simTimeSeconds / TIME_60; simTimeSeconds = simTimeSeconds - (minutes * TIME_60); int seconds = simTimeSeconds; return nf.format(hours) + ":" + nf.format(minutes) + ":" + nf.format(seconds); |
String | getFullDateByMisSecond(long misSecond) get Full Date By Mis Second if (misSecond < 0) { throw new IllegalArgumentException("The misSecond must not be negative"); if (misSecond == 0) { return "--"; Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(misSecond); ... |
Date | getFutureDate(int seconds) get Future Date Calendar now = Calendar.getInstance();
now.add(Calendar.SECOND, seconds);
return now.getTime();
|
long | getIntervalMilSeconds(String startDateStr, String endDateStr, String dateFormat) get Interval Mil Seconds SimpleDateFormat format = new SimpleDateFormat(dateFormat); Date startDate = format.parse(startDateStr); Date endDate = format.parse(endDateStr); return endDate.getTime() - startDate.getTime(); |
long | getMisSecond(String strDate) get Mis Second return getDate(strDate, "yyyy-MM-dd HH:mm:ss").getTime(); |
String | getSecond() get Second Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(currentTime); String min; min = dateString.substring(17, 19); return min; |
double | getSecond() get Second return format((double) getMili() / 1000.0); |
String | getSecond() Get the current second Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("ss"); String output = format.format(date); return output; |
String | getSecond(Date date) get Second return FormatDate(date, "ss"); |
int | getSecond(String time) get Second String cc = "1970-01-01 00:00:00"; final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); final SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm:ss"); Calendar cal = Calendar.getInstance(); try { cal.setTime(sdf1.parse(time)); } catch (ParseException e) { e.printStackTrace(); ... |