Java tutorial
//package com.java2s; import java.text.ParseException; public class Main { public static float getTimeDiff(String start, String end) { java.text.DateFormat df = new java.text.SimpleDateFormat("HH:mm:ss"); java.util.Date date1 = null, date2 = null; try { date1 = df.parse(start); date2 = df.parse(end); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return (float) ((date2.getTime() - date1.getTime())); } }