0

I want to read a txt file containing Strings like this: Friday 12:00-15:00 and mixed many other dates line by line (Ddd hh:mm-hh:mm). And my question is that, what is the most elegant way to calculate between two "lessons" the break?!

For example: 1. lesson start at Friday 12:00 to 15:00 and the second one is 17:00 to 19:00. So the break between the lessons is 2 hours.

I would like to create a time-table and calculate the freetime before the next lesson starts.

What is the best way to do it? Convert String to Date format or separate String to "days and lessons" and substract start from end?

  • 2
    Don't worry about trying to do it the "best" way. Try to get it working any way possible, then improve from there if you don't like how it turned out. – Nathan Norman Mar 22 '18 at 14:54
  • This is apt: https://stackoverflow.com/a/28353857/1004631 – robot_alien Mar 22 '18 at 15:42
  • Ahw thanks. Furthermore is it possible to get the difference without separate the String? I mean Friday 12:00 and 15:00, and after this use LocalTime.. I hope it clear. – Mark Kalydy Mar 22 '18 at 19:10

0 Answers0