// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeSub {
   private static final DateFormat df = new SimpleDateFormat("HH.mm");
   public static void main(String[] args) {
      test("1.00", "2.25");
      test("2.25", "1.00");
   }
   private static void test(String ts1, String ts2) {
      try {
         Date t1 = df.parse(ts1);
         Date t2 = df.parse(ts2);
         int dif = (int) ((t2.getTime() - t1.getTime()) / 1000);
         if(dif < 0) {
            dif += 24 * 60 * 60;
         }
         int h = dif / 3600;
         int m = (dif - h * 3600) / 60;
         System.out.println(ts1 + "-" + ts2 + " = " + h + " timer " + m + " minutter");
      } catch (ParseException e) {
         e.printStackTrace();
      }
   }
}
