I am trying to get the difference between time which is in the form of string but i am getting the difference has 0 always,i am working on blackberry .
long startTime = HttpDateParser.parse("01:00:00");
System.out.println("start time is :" + startTime);
long endTime = HttpDateParser.parse("02:00:00");
System.out.println("end time is :" + endTime);
long diff = endTime - startTime;
long diffHours = diff / (60 * 60 * 1000);
If you want to calculate only time between two times in same day which are formatted as “HH:MM:SS” then it is pretty much easy
Use simple HttpDateParser and take any date which have proper format
like “Tue, 27 Mar 2012 09:11:37 GMT”
here we replace only time then you will get time in millies between two times
I got output as
Note : If you want to calculate between two different days
Here you need to pass date format should be proper like example: “YYYY-mm-dd hh:mm:ss”
here i provide some sample example
you can see as following output in your screen
