Here you can find the source of daysHoursMinutesToMillis(String expression)
Parameter | Description |
---|---|
expression | string representing time in [days:][hours:]minutes. |
public static long daysHoursMinutesToMillis(String expression)
//package com.java2s; public class Main { private static final long[] MILLIS_EQUIV = { 24 * 60 * 60 * 1000, 60 * 60 * 1000, 60 * 1000 }; /**// w w w . j a va 2 s .c o m * Computes milliseconds from an expression [dd:][HH:]mm. * * @param expression * string representing time in [days:][hours:]minutes. * @return corresponding time in milliseconds. */ public static long daysHoursMinutesToMillis(String expression) { String[] ddHHmm = expression.split(":"); long total = 0; int j = 2; for (int i = ddHHmm.length - 1; i >= 0; i--) total += (Integer.parseInt(ddHHmm[i]) * MILLIS_EQUIV[j--]); return total; } }