I want to make a personal schedule manager using Java and Joda Time. The user has a certain period in a day (eg. 10am-4pm) , for each day in a month. He should be able to extract a period from his day and "add" a list of chores (ie strings) to this period. Then he will be shown the remaining portion of his day. He can extract more periods from this until he has no time periods left. He can add an extracted period back to the schedule for the day and remove all chores for that period, that is free time.
The size of a time slice that can be extracted is decided by the user. number of time slices = total time available in a day/size of time-slice set by user = num of time slices of desired size + remainder time
He can divide his day into chunks of 1hr, 30 mins, 15 mins, 20mins, 40mins etc.
ADDED: The user needs to have his whole schedule saved so that he can come back and check what he was doing in the past. The hours each day can be variable - 10am-4pm, 9am-1pm etc
I am new to Joda Time and I don't know if this is possible in Joda Time and if possible, is it easy or cumbersome. I only need some guidance. I am not asking for the whole code to be typed for me.
Thanks in advance.
Method split start and end in given interval.
To achieve what you describe, you need to caculate the chunk length and store begin time and end time for each chunk. Through JodaTime, it is every easy to calculate a chunk's begin time and end time. It provides API like DateTime#plusHours (add N hours), DateTime#plusMinutes (add N minutes).
For example:
here's the updated code
output from this run is
however, if you change the firstEvent to
output from the run is