Java Utililty Methods Minute Parse

List of utility methods to do Minute Parse

  1. HOME
  2. Java
  3. M
  4. Minute Parse

Description

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

Method

int parseHHMMStringToMinutes(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);
Long parseHourAndMinute(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]);
...
String parseIntForMinute(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 {
...
String parseMinutes(long time)
parse Minutes
SimpleDateFormat format = new SimpleDateFormat("mm:ss", Locale.GERMANY);
Date date = new Date(time);
return format.format(date);
int parseMinutes(String minutes, int defaultValue)
parse Minutes
try {
 return Integer.parseInt(minutes);
} catch (Exception ex) {
 return defaultValue;
String parseMinutes(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;


AltStyle によって変換されたページ (->オリジナル) /