Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static int stringTimeToInt(String time) { String[] fields = time.split(":"); int secs = Integer.parseInt(fields[0]) * 3600 + Integer.parseInt(fields[1]) * 60; if (fields.length > 2) secs += Integer.parseInt(fields[2]); return secs; } }