Am implementing a default range picker and I would like the user to specify the default duration range
So in my ranges I have
1 day = 24 hours
3 days = 24 * 3 hours
1 week = 24 * 7 hours
1 month
My logic is using the total hours in a day and multiply by total days
But now the problem comes in when the range becomes more than 2 months, since some months have 31 day, 28 days and even 30days
SO how do I go about determining example the last two months from now the number of hours, so that in my calendar I can simply
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR, cal.get(Calendar.HOUR) - hours) //stuck here
SO in simple terms example
today being april 2, how do I get the number of hours from january 2 to april 2.
SO in my own logic it for more than one month it should look like:
Date today = Date.now();
LocalDate userday = LocalDate.of(less number of months);
Period diff = Period.between(userday, today);