Java Utililty Methods Minute

List of utility methods to do Minute

Description

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

Method

doubleaddMinutesToMjd(double mjd, double minutes)
Add minutes to Modified Julian Date and return the result
double timeInMinutes = (mjd - mjdAtJanFirst1970) * daysToMinutes;
double newTimeInMinutes = timeInMinutes + minutes;
return newTimeInMinutes * minutesToDays + mjdAtJanFirst1970;
StringbuildDelayParamForMinutes(final int delayInMinutes)
build Delay Param For Minutes
if (delayInMinutes <= 0) {
    throw new IllegalArgumentException("delayInMinutes must be > 0");
StringBuilder sbBuilder = new StringBuilder();
sbBuilder.append("\"<PLUSET>");
sbBuilder.append(delayInMinutes);
sbBuilder.append("m</PLUSET><EF>24h</EF>\"");
return sbBuilder.toString();
...
StringcalculateRuntimeMinutes(long startTime, long endTime)
calculate Runtime Minutes
long seconds = Math.round((endTime - startTime) / 1000.0);
int hours = (int) (seconds / 3600.0);
int rest1 = (int) (seconds % (3600.0));
int minutes = (int) (rest1 / 60.0);
seconds = (int) (seconds - (hours * 3600 + minutes * 60));
String h = "" + hours;
String m = "" + minutes;
String s = "" + seconds;
...
intcalMinutes(Date date1, Date date2)
cal Minutes
int times = 0;
times = (int) ((date1.getTime() - date2.getTime()) / (60 * 1000));
return times;
IntegercountMinute(Long time)
count Minute
Long days = time / 60000;
return days.intValue();
intelapsedMinutes(int beginTimeInMinutes, int endTimeInMinutes)
elapsed Minutes
return Math.abs(endTimeInMinutes - beginTimeInMinutes);
longextractMinutes(String[] parts)
extract Minutes
int length = parts.length;
if (length < 2) {
    return 0L;
return Long.parseLong(parts[length - 2]) * 60;
DatefloorTimestamp(Date ts, int windowMinutes)
floor Timestamp
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
int modulo = calendar.get(Calendar.MINUTE) % windowMinutes;
if (modulo > 0) {
    calendar.add(Calendar.MINUTE, -modulo);
long finalTS = calendar.getTime().getTime() / 1000;
...
DategetDateAfter(Date date, int minute)
get Date After
Calendar calendar = Calendar.getInstance();
if (date != null) {
    calendar.setTime(date);
} else {
    calendar.setTime(new Date());
calendar.add(Calendar.MINUTE, minute);
return calendar.getTime();
...
DategetDateTime(Date d, int hour, int minute, int second, int millisecond)
Returns the passed date, at the specified time
Calendar c = Calendar.getInstance();
c.setTime(d);
c.set(Calendar.HOUR_OF_DAY, hour);
c.set(Calendar.MINUTE, minute);
c.set(Calendar.SECOND, second);
c.set(Calendar.MILLISECOND, millisecond);
return c.getTime();