Java tutorial
//package com.java2s; public class Main { /** * "07:01" = 7*60*60*1000+1000; * @return */ public static long parseToTimeInMillis2(String string) { if (string.contains(":")) { String[] srs = string.split(":"); int h = Integer.valueOf(srs[0]); int m = Integer.valueOf(srs[1]); long hour = h * 60 * 60 * 1000; long mm = m * 60 * 1000; return hour + mm; } return 0; } }