The list of methods to do Second are organized into topic(s).
Date
addSecond(Date beginDate, int addcount) add Second
Calendar cal = Calendar.getInstance();
cal.setTime(beginDate);
cal.add(Calendar.SECOND, addcount);
Date enddate = cal.getTime();
return enddate;
String
addTimes(String dateTime, int second) add Times
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
java.util.Date date1 = null;
try {
date1 = format.parse(dateTime);
} catch (ParseException e) {
e.printStackTrace();
long Time = (date1.getTime() / 1000) + second;
...
void
advanceCurrentTimeSeconds() Wait until the System#currentTimeMillis / 1000 advances.
long currentTimeSeconds = System.currentTimeMillis() / 1000;
do {
Thread.sleep(50);
} while (currentTimeSeconds == System.currentTimeMillis() / 1000);
String
asStringInSeconds(long duration) as String In Seconds
long seconds = duration / 1000;
long milliSeconds = duration - (seconds * 1000);
return String.valueOf(seconds) + "." + asThreeDigits(milliSeconds);