user3387331
user3387331

Reputation: 1

How to find Difference between to time durations in java?

Please Help me on this.

I had two duration times in string format: Ex: "10" and "0.30"(actually there are in minutes)

I parsed those values Double and find the find the difference?

But I am getting the output as 9.7 which is wrong I want it as 9.30.. Please suggest

Thanks in advance!

Upvotes: 0

Views: 121

Answers (2)

user2058780
user2058780

Reputation:

Convert the double into minutes, Here is the link that can help you Convert the string "8:00" into the minutes (integer value).

Upvotes: 0

amudhan3093
amudhan3093

Reputation: 750

You can use the Joda-Time Library.Use the Period class from which you can get the difference between two times in terms of hours and minutes.For example refer the second answer to this question

Upvotes: 1

Related Questions