Java Utililty Methods Minute Convert

List of utility methods to do Minute Convert

Description

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

Method

intconvertMinutesToSeconds(int minutesToConvert)
converts a given time from minutes -> seconds
return minutesToConvert * 60;
StringconvertMsToMinutesAndSeconds(long ms)
Convert milliseconds to mm:ss display format Note we don't break into hours, 3900000 ms would display as 65:00 , and we dont put a zero before single digit minutes
int seconds = (int) ((ms / 1000) % 60);
int minutes = (int) (ms / 60000);
String secondsStr = (seconds < 10 ? "0" : "") + seconds;
return new String(minutes + ":" + secondsStr);
StringconvertOffsetToMinutesSeconds(int offset)
Convert a given millisecond offset into mm:ss string format
int seconds = (int) (offset / 1000);
int minutes = seconds / 60;
String strSeconds = new String();
seconds = seconds - (minutes * 60);
if (seconds < 10) {
    strSeconds = "0" + seconds;
} else {
    strSeconds = "" + seconds;
...
StringconvertOffsetToMinutesSecondsMillis(int offset)
convert Offset To Minutes Seconds Millis
int millis = offset;
int seconds = (int) (millis / 1000);
int minutes = seconds / 60;
String strMillis = new String();
String strSeconds = new String();
String strMinutes = new String();
millis = millis - (seconds * 1000);
seconds = seconds - (minutes * 60);
...
StringconvertSecondsToHoursMinutesSeconds(int offset)
Converts a second offset into a friendlier hh:mm:ss format & returns the string.
int seconds = offset;
int minutes = seconds / 60;
int hours = minutes / 60;
String strSeconds = new String();
String strMinutes = new String();
seconds = seconds - (minutes * 60);
minutes = minutes - (hours * 60);
if (seconds < 10) {
...
doubleconvertSecondsToMinutes(double seconds)
convert Seconds To Minutes
return seconds / 60;
StringconvertTicksToMinutesAndSeconds(int ticks, boolean fraction)
Takes in the amount of ticks, and converts it into a time notation.
String part = ticks % 20 * 5 + "";
if (part.length() < 2)
    part = "0" + part;
ticks /= 20;
if (ticks < 60) {
    return ticks + (fraction ? "." + part : "") + "s";
} else {
    return ticks / 60 + "m";
...
longconvertTimemilisecondsToMinutes(long time)
convert Timemiliseconds To Minutes
long minutes = 0;
minutes = time / (60 * 1000);
return minutes;
StringminutesToHHMM(int mins)
minutes To HHMM
String result = "";
int hours = mins / 60, minutes = mins % 60;
String disHour = (hours < 10 ? "0" : "") + hours, disMinu = (minutes < 10 ? "0" : "") + minutes;
result = disHour + ":" + disMinu;
return result;
longminutesToMillis(double minutes)
utility to convert a given number of minutes to milliseconds
return (long) (minutes * 60 * 1000);