Java Utililty Methods Second Format

List of utility methods to do Second Format

Description

The list of methods to do Second Format are organized into topic(s).

Method

StringgetFormattedDuration(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);
StringgetFullDateByMisSecond(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);
...
DategetFutureDate(int seconds)
get Future Date
Calendar now = Calendar.getInstance();
now.add(Calendar.SECOND, seconds);
return now.getTime();
longgetIntervalMilSeconds(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();
longgetMisSecond(String strDate)
get Mis Second
return getDate(strDate, "yyyy-MM-dd HH:mm:ss").getTime();
StringgetSecond()
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;
doublegetSecond()
get Second
return format((double) getMili() / 1000.0);
StringgetSecond()
Get the current second
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("ss");
String output = format.format(date);
return output;
StringgetSecond(Date date)
get Second
return FormatDate(date, "ss");
intgetSecond(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();
...