List of utility methods to do Time to Milliseconds Convert
int | time2IntMillis(String timestr) time Int Millis String[] times = timestr.split(":"); if (times.length == 1) { return Integer.parseInt(times[0]) * 1000; } else if (times.length == 2) { return (Integer.parseInt(times[0]) * 60 + Integer .parseInt(times[1])) * 1000; } else if (times.length == 3) { return 0; ... |
long | time2LongMillis(String timestr) time Long Millis String[] times = timestr.split(":"); if (times.length == 1) { return Long.parseLong(times[0]) * 1000; } else if (times.length == 2) { return (Long.parseLong(times[0]) * 60 + Long .parseLong(times[1])) * 1000; } else if (times.length == 3) { return (Long.parseLong(times[0]) * 3600 ... |
long | timeStr2Secs(String s) Converts a String in the format 00:00 to a long, being the number of seconds long seconds = 0; String parts[] = s.split(":", 2); switch (parts.length) { case 2: long minutes = Long.parseLong(parts[0]); seconds += minutes * 60; seconds += Long.parseLong(parts[1]); break; ... |
long | getTimeinMillis(int year, int month, int day) get Timein Millis Calendar cal = Calendar.getInstance();
cal.set(year, month - 1, day);
return cal.getTimeInMillis();
|