Java Utililty Methods Minute Parse

List of utility methods to do Minute Parse

Description

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

Method

intparseHHMMStringToMinutes(String time)
Return the number of minutes for an hh:mm time value.
String[] values = time.split(COLON);
if (values.length == 2) {
    try {
        int hours = Integer.parseInt(values[0]);
        int minutes = Integer.parseInt(values[1]);
        return hours * 60 + minutes;
    } catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid Time entry not HH:MM, was '" + time);
LongparseHourAndMinute(String value)
parse Hour And Minute
value = value.trim();
String[] comp = value.split(":");
if (comp.length != 2) {
    return 0L; 
try {
    int hours = Integer.parseInt(comp[0]);
    int minutes = Integer.parseInt(comp[1]);
...
StringparseIntForMinute(Integer i)
parse Int For Minute
int i2 = i;
int minutes = 0;
boolean stop = false;
while (!stop) {
    if ((i2 - 60) >= 0) {
        minutes++;
        i2 -= 60;
    } else {
...
StringparseMinutes(long time)
parse Minutes
SimpleDateFormat format = new SimpleDateFormat("mm:ss", Locale.GERMANY);
Date date = new Date(time);
return format.format(date);
intparseMinutes(String minutes, int defaultValue)
parse Minutes
try {
    return Integer.parseInt(minutes);
} catch (Exception ex) {
    return defaultValue;
StringparseMinutes(String timeInMinutes)
parse Minutes
if (timeInMinutes == null)
    return null;
int time = Integer.parseInt(timeInMinutes);
int minutes = time % 60;
String pad = (minutes < 10 ? "0" : "");
return "" + (int) Math.floor(time / 60) + ":" + pad + minutes;