I have a scenario to generate specific time between two dates. Let's say Mar 1st to Mar 31st as my input. I need to generate datetime with specific hours as below.
Mar 1st 03:00 - Mar 1st 06:59
Mar 1st 07:00 - Mar 1st 14:59
Mar 1st 15:00 - Mar 2nd 02:59
Mar 2nd 03:00 - Mar 2nd 06:59
Mar 2nd 07:00 - Mar 2nd 14:59
.
.
.
.
Mar 31st 15:00 - Mar 31st 02:59
I am confused how to generate these different time periods using joda. Help me to generate these times.
I have implemented a solution for practicing the Joda library:
The output is the following:
As you can notice, there is a small difference between my output and your output. If you take the time to understand what I have written, you can easily fix it by yourself.