Java how to calculate time differences -


If user input is 2255 and 2305 then how can I calculate time differences in 24 hours, output should be 10 minutes needed. I got an idea that the input is to separate the two parts, 2 digits and 2 digits. The first 2 digit is the hour, 60 to 60 times, minutes to make it. Then plus it with the second 2 digits and then calculate the differences. I do not want to use any date calendar data type or API to resolve it. Thanks

How to obtain the first 2 digits without using the string chart

< / Blockquote>

Highest two digits: Number / 100 minimum two diastom: number% 100

But what if the user enters 3:05 or 3-05? I think that this is the problem of applicability The best solution for the user UI definitely makes sense. For example, you can use different fields for hours and minutes.


Comments